The Issue
It appears as though this code is causing an error because the function Dialog.open passed to the event by this code is either null, undefined, or a function. Neither of which will have an id property to destructure.
How to Reproduce
- Install Tweaks n' Stuff.
- Open any project.
- Open that project's properties dialog.
- Close that project's properties dialog.
- Note the error in the log.
The fix
The hide_dialog event dispatcher should instead set it's event data like so:
Dialog.prototype.hide = function (...args) {
// @ts-ignore
Blockbench.dispatchEvent("hide_dialog", {dialog: this});
return Mixins.hideDialog.apply(this, args);
};
And the event listener should expect such data:
const hide = Blockbench.on("hide_dialog", ({ dialog }) => {
if (dialog.id !== "settings_profile") return;
this.update();
});
@legopitstop
The Issue
It appears as though this code is causing an error because the function
Dialog.openpassed to the event by this code is eithernull,undefined, or a function. Neither of which will have anidproperty to destructure.How to Reproduce
The fix
The hide_dialog event dispatcher should instead set it's event data like so:
And the event listener should expect such data:
@legopitstop