()
| 253 | * actually changed. |
| 254 | */ |
| 255 | export function setupPluginHookHotReload(): void { |
| 256 | if (hotReloadSubscribed) { |
| 257 | return |
| 258 | } |
| 259 | hotReloadSubscribed = true |
| 260 | |
| 261 | // Capture the initial snapshot so the first policySettings change can compare |
| 262 | lastPluginSettingsSnapshot = getPluginAffectingSettingsSnapshot() |
| 263 | |
| 264 | settingsChangeDetector.subscribe(source => { |
| 265 | if (source === 'policySettings') { |
| 266 | const newSnapshot = getPluginAffectingSettingsSnapshot() |
| 267 | if (newSnapshot === lastPluginSettingsSnapshot) { |
| 268 | logForDebugging( |
| 269 | 'Plugin hooks: skipping reload, plugin-affecting settings unchanged', |
| 270 | ) |
| 271 | return |
| 272 | } |
| 273 | |
| 274 | lastPluginSettingsSnapshot = newSnapshot |
| 275 | logForDebugging( |
| 276 | 'Plugin hooks: reloading due to plugin-affecting settings change', |
| 277 | ) |
| 278 | |
| 279 | // Clear all plugin-related caches |
| 280 | clearPluginCache('loadPluginHooks: plugin-affecting settings changed') |
| 281 | clearPluginHookCache() |
| 282 | |
| 283 | // Reload hooks (fire-and-forget, don't block) |
| 284 | void loadPluginHooks() |
| 285 | } |
| 286 | }) |
| 287 | } |
| 288 |
no test coverage detected