fix(dialogs): refresh gestion herbes/potions/ingredients après édition fiche

Souscrit aux hooks updateItem/createItem/deleteItem pour
re-render le dialog quand un item de l'acteur change.
Nettoyage des hooks via _onClose().
This commit is contained in:
fabres
2026-07-22 00:29:56 +02:00
parent 54fc1e8e1a
commit d06f1de433
3 changed files with 36 additions and 0 deletions
+12
View File
@@ -36,6 +36,18 @@ export class DialogGererHerbes extends HandlebarsApplicationMixin(ApplicationV2)
constructor(options) {
super(options)
this.actor = options.actor
this._onItemChange = (item) => {
if (item.parent === this.actor) this.render(true)
}
Hooks.on("updateItem", this._onItemChange)
Hooks.on("createItem", this._onItemChange)
Hooks.on("deleteItem", this._onItemChange)
}
_onClose() {
Hooks.off("updateItem", this._onItemChange)
Hooks.off("createItem", this._onItemChange)
Hooks.off("deleteItem", this._onItemChange)
}
async _prepareContext() {
+12
View File
@@ -34,6 +34,18 @@ export class DialogGererIngredients extends HandlebarsApplicationMixin(Applicati
constructor(options) {
super(options)
this.actor = options.actor
this._onItemChange = (item) => {
if (item.parent === this.actor) this.render(true)
}
Hooks.on("updateItem", this._onItemChange)
Hooks.on("createItem", this._onItemChange)
Hooks.on("deleteItem", this._onItemChange)
}
_onClose() {
Hooks.off("updateItem", this._onItemChange)
Hooks.off("createItem", this._onItemChange)
Hooks.off("deleteItem", this._onItemChange)
}
async _prepareContext() {
+12
View File
@@ -34,6 +34,18 @@ export class DialogGererPotions extends HandlebarsApplicationMixin(ApplicationV2
constructor(options) {
super(options)
this.actor = options.actor
this._onItemChange = (item) => {
if (item.parent === this.actor) this.render(true)
}
Hooks.on("updateItem", this._onItemChange)
Hooks.on("createItem", this._onItemChange)
Hooks.on("deleteItem", this._onItemChange)
}
_onClose() {
Hooks.off("updateItem", this._onItemChange)
Hooks.off("createItem", this._onItemChange)
Hooks.off("deleteItem", this._onItemChange)
}
async _prepareContext() {