From 321654f731f47e0591f1810501e38a405239a738 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Thu, 7 Jan 2021 10:58:43 +0100 Subject: [PATCH] 20Q better refresh, stay in same tab --- system/scripts/actors/twenty-questions-dialog.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index fbd093f..86c43a5 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -60,7 +60,9 @@ export class TwentyQuestionsDialog extends FormApplication { class: "twenty-questions", icon: "fas fa-sync-alt", onclick: async () => { - await new TwentyQuestionsDialog(this.actor).render(true); + this._initialize(game.actors.get(this.actor._id)); + await this._constructCache(); + this.render(false); }, }); return buttons; @@ -71,6 +73,14 @@ export class TwentyQuestionsDialog extends FormApplication { */ constructor(actor = null, options = {}) { super({}, options); + this._initialize(actor); + } + + /** + * Initialize actor and object for dialog + * @private + */ + _initialize(actor) { this.actor = actor; this.object = new TwentyQuestions(actor); this.summary = this.object.validateForm();