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 <cursoragent@cursor.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Fusion Repairs',
|
'name': 'Fusion Repairs',
|
||||||
'version': '19.0.2.2.1',
|
'version': '19.0.2.2.3',
|
||||||
'category': 'Inventory/Repairs',
|
'category': 'Inventory/Repairs',
|
||||||
'summary': 'Guided medical equipment repair intake, dispatch, maintenance, and self-service portal',
|
'summary': 'Guided medical equipment repair intake, dispatch, maintenance, and self-service portal',
|
||||||
'description': """
|
'description': """
|
||||||
|
|||||||
@@ -78,6 +78,21 @@ export class FlowchartDesigner extends Component {
|
|||||||
// Per-selected-node Wysiwyg editor instance captured via onLoad.
|
// Per-selected-node Wysiwyg editor instance captured via onLoad.
|
||||||
// Keyed by dfId so switching nodes correctly reads the right editor.
|
// Keyed by dfId so switching nodes correctly reads the right editor.
|
||||||
this.wysiwygEditors = {};
|
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;
|
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() {
|
_initDrawflow() {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
this.editor = new Drawflow(this.canvasRef.el);
|
this.editor = new Drawflow(this.canvasRef.el);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
<div class="fr-wysiwyg-shell">
|
<div class="fr-wysiwyg-shell">
|
||||||
<Wysiwyg t-key="'wysiwyg-' + state.selectedNodeId"
|
<Wysiwyg t-key="'wysiwyg-' + state.selectedNodeId"
|
||||||
config="wysiwygConfig"
|
config="wysiwygConfig"
|
||||||
onLoad="onWysiwygLoad.bind(this)"
|
onLoad.bind="onWysiwygLoad"
|
||||||
contentClass="'fr-wysiwyg-content'"/>
|
contentClass="'fr-wysiwyg-content'"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text">Bold, italic, lists, links and inline images supported. Click <em>HTML Source</em> to paste raw markup.</div>
|
<div class="form-text">Bold, italic, lists, links and inline images supported. Click <em>HTML Source</em> to paste raw markup.</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user