## Issue Summary
The mind map diagram fails to load in non-local environments (dev/staging/prod)
but works correctly in the local environment.
## Root Cause Identified
Through line-by-line code comment testing, the issue has been isolated to:
this.diagram.data.parse(this.prepareDimensions(this.mindMapData));
Commenting out this line prevents the diagram from loading entirely, confirming
it is the sole entry point for diagram initialization and data rendering.
## prepareDimensions Method
private prepareDimensions(data: any[]): any[] {
return data.map(n => ({
...n,
type: n.type === 'endline' ? 'endline' : n.type || 'rectangle',
}));
}
This method works correctly in local but the behavior differs in other environments.
## Suspected Causes
- mindMapData is null or undefined at the time parse() is called (timing/async issue)
- diagram object not fully initialized before parse() is invoked
- Library version mismatch between local and deployed builds
- Environment-specific data causing an unhandled edge case
## Current Status
Investigation ongoing. Additional support or insights are welcome.
Hello @jxp0t9efpl,
Thank you for the detailed issue description and the provided code.
The problem highly likely happens because parse() is called before valid data (or before full editor readiness) in non-local environments.
In local setup, timing is usually faster/more stable, so this is not visible.
If you add a safe guard before parsing, something like follows:
private prepareDimensions(data: any[] | null | undefined): any[] {
return Array.isArray(data)
? data.map(n => ({
...n,
type: n?.type === "endline" ? "endline" : n?.type || "rectangle",
}))
: [];
}
private initMindMapData(): void {
if (!this.diagram?.data) return;
const prepared = this.prepareDimensions(this.mindMapData);
if (!prepared.length) {
console.warn("Mind map data is empty/invalid:", this.mindMapData);
return;
}
this.diagram.data.parse(prepared);
}
Also, it would be helpful if you test these checks in dev/staging/prod:
- log this.mindMapData right before parse()
- log this.diagram and this.diagram.data readiness
- compare loaded Diagram library version/build hash with local
This will confirm whether the root cause is data timing/shape mismatch or environment version mismatch.
Kind regards,
1 Like