FIX: correctly destroy menu/tooltip when removed from dom

This fix will ensure we correctly play the close/destroy sequence in this situation.
This commit is contained in:
Joffrey JAFFEUX 2024-11-26 15:55:35 +01:00 committed by GitHub
parent 93443adf22
commit 96b88f34a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,10 @@ export default class DMenu extends Component {
registerTrigger = modifier((element) => {
this.menuInstance.trigger = element;
this.options.onRegisterApi?.(this.menuInstance);
return () => {
this.menuInstance.destroy();
};
});
get menuId() {

View File

@ -23,6 +23,10 @@ export default class DTooltip extends Component {
registerTrigger = modifier((element) => {
this.tooltipInstance.trigger = element;
this.options.onRegisterApi?.(this.tooltipInstance);
return () => {
this.tooltipInstance.destroy();
};
});
get options() {