additionalParams argument. Use it to pass row data, button state, or any extra values the action handler should react to.',
+ type: 'object',
+ optional: true
+ }
+ ]
}
}
},
@@ -736,6 +758,17 @@ export const widgetContextCompletionsWithSettings = (settingsCompletions?: TbEdi
}
}
}
+ },
+ registerDestroyCallback: {
+ description: 'Registers a teardown callback that will be invoked exactly once when the widget is about to be destroyed (dashboard navigation, edit/view switch, layout change, etc.). Use it to release resources acquired during widget setup so they don\'t leak across widget reloads — e.g. unsubscribe RxJS subscriptions, detach DOM/window event listeners, clear setInterval / setTimeout timers, abort outstanding HTTP requests, destroy third-party plugin instances. Multiple callbacks may be registered; they are executed in registration order.',
+ meta: 'function',
+ args: [
+ {
+ description: 'Zero-argument function executed when the widget is destroyed. Should be idempotent — synchronously dispose of one specific resource (e.g. one subscription or one listener) and avoid throwing; throwing here may prevent later cleanup callbacks from running.',
+ name: 'destroyCallback',
+ type: '() => void',
+ }
+ ]
}
},
...serviceCompletions
diff --git a/ui-ngx/src/app/shared/models/ai-model.models.ts b/ui-ngx/src/app/shared/models/ai-model.models.ts
index 504e4d2659..575eba1d33 100644
--- a/ui-ngx/src/app/shared/models/ai-model.models.ts
+++ b/ui-ngx/src/app/shared/models/ai-model.models.ts
@@ -105,11 +105,11 @@ export const AiModelMap = new Map