From dec670ac4358064a96b7f589cadd18edcc342065 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 2 Jun 2022 17:49:16 +0200 Subject: [PATCH] FIX: ensure we have the right upload ID when navigating between steps --- .../discourse/initializers/custom-wizard-edits.js.es6 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 index 20787b4e..cecf2a03 100644 --- a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 +++ b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 @@ -1,6 +1,7 @@ import DiscourseURL from "discourse/lib/url"; import { withPluginApi } from "discourse/lib/plugin-api"; import getUrl from "discourse-common/lib/get-url"; +import { observes } from "discourse-common/utils/decorators"; export default { name: "custom-wizard-edits", @@ -35,6 +36,16 @@ export default { }, }, }); + + api.modifyClass("component:uppy-image-uploader", { + // Needed to ensure appEvents get registered when navigating between steps + @observes("id") + initOnStepChange() { + if (/wizard-field|wizard-step/.test(this.id)) { + this._initialize(); + } + }, + }); }); }, };