From 2414b6328edaa6cb5279db80a9249f7d3443e6af Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Wed, 27 May 2026 13:44:58 -0400 Subject: [PATCH] fix(fusion_repairs): designer setup() scope - onMounted/onWillUnmount were stranded outside, broke entire backend bundle REGRESSION FROM b22bb11b (Wysiwyg integration). While inserting the new Wysiwyg methods (wysiwygConfig getter, onWysiwygLoad, onToggleSource) between setup() and the existing onMounted / onWillUnmount hook calls, I accidentally closed setup() early with the new `this.wysiwygEditors = {};` assignment. That left the original `onMounted(async () => {...});` and `onWillUnmount(...);` calls dangling INSIDE the class body but OUTSIDE any method - which is invalid JS. JavaScript's class-body parser sees the bare `onMounted(async () => ...)` and tries to interpret it as a method declaration where `onMounted` is the name and the parens are the parameter list. `async () => {...}` is not a valid parameter, so the bundle fails with: Uncaught SyntaxError: Unexpected token '(' web.assets_web.min.js:28807 That single parse failure tanks the entire backend asset bundle, leaving users with a completely blank screen on /odoo (and any other backend route). Frontend bundle was unaffected. FIX Move the onMounted / onWillUnmount calls back inside setup() where they belong. Add a load-bearing comment explaining why they must stay there so this regression cannot silently come back during a future refactor. VERIFIED - line 51: setup() opens - lines 87, 93: onMounted, onWillUnmount calls INSIDE setup - line 142: _initDrawflow as a normal class method (outside setup) - upgrade clean - bundle 10029245 bytes, exactly one onMounted( occurrence in FlowchartDesigner class body - node --check on the freshly-rendered web.assets_web.min.js -> PARSE_OK Bumped to 19.0.2.2.3. Co-authored-by: Cursor --- fusion_repairs/__manifest__.py | 2 +- .../flowchart_designer/flowchart_designer.js | 26 +++++++++++-------- .../flowchart_designer/flowchart_designer.xml | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/fusion_repairs/__manifest__.py b/fusion_repairs/__manifest__.py index bf802654..cc9c2f3c 100644 --- a/fusion_repairs/__manifest__.py +++ b/fusion_repairs/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Fusion Repairs', - 'version': '19.0.2.2.1', + 'version': '19.0.2.2.3', 'category': 'Inventory/Repairs', 'summary': 'Guided medical equipment repair intake, dispatch, maintenance, and self-service portal', 'description': """ diff --git a/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.js b/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.js index 07777bc9..800f2240 100644 --- a/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.js +++ b/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.js @@ -78,6 +78,21 @@ export class FlowchartDesigner extends Component { // Per-selected-node Wysiwyg editor instance captured via onLoad. // Keyed by dfId so switching nodes correctly reads the right editor. this.wysiwygEditors = {}; + + // Drawflow init + chart load happen on mount; cleanup on unmount. + // These onMounted / onWillUnmount hooks MUST stay inside setup() - + // they are not class methods. Leaving them outside throws + // "Unexpected token (" because JS parses bare function calls in a + // class body as malformed method declarations. + onMounted(async () => { + await Promise.all([loadJS(DRAWFLOW_JS), loadCSS(DRAWFLOW_CSS)]); + this._initDrawflow(); + await this._loadChart(); + }); + + onWillUnmount(() => { + try { this.editor?.clear(); } catch {} + }); } // ------------------------------------------------------------------ @@ -124,17 +139,6 @@ export class FlowchartDesigner extends Component { this.state.sourceMode = !this.state.sourceMode; } - onMounted(async () => { - await Promise.all([loadJS(DRAWFLOW_JS), loadCSS(DRAWFLOW_CSS)]); - this._initDrawflow(); - await this._loadChart(); - }); - - onWillUnmount(() => { - try { this.editor?.clear(); } catch {} - }); - } - _initDrawflow() { // eslint-disable-next-line no-undef this.editor = new Drawflow(this.canvasRef.el); diff --git a/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.xml b/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.xml index 2af756d0..4d2f9356 100644 --- a/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.xml +++ b/fusion_repairs/static/src/components/flowchart_designer/flowchart_designer.xml @@ -91,7 +91,7 @@
Bold, italic, lists, links and inline images supported. Click HTML Source to paste raw markup.