fix(export): prevent vis-network stack overflow crash on HTML render

Resolves the `BarnesHutSolver.js` maximum call stack size exceeded
error. By explicitly initializing node X/Y coordinates using a
sunflower spiral (Fermat's spiral) formula, nodes no longer spawn
stacked on top of each other. This prevents `avoidOverlap` physics
forces from dividing by zero and exploding into infinite values
on the very first frame.

(cherry picked from commit a20b3593bd)
This commit is contained in:
Sanjaiyan Parthipan authored and safishamsi committed 2026-09-20 18:01:00 +01:00
1 parent 785ee5a426
commit 124c263488
1 file changed
+2
+2
View File
@@ -151,6 +151,8 @@ function esc(s) {{
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({{
id: n.id, label: n.label, color: n.color, size: n.size,
font: n.font, title: n.title,
x: 30 * Math.sqrt(i) * Math.cos(i * 2.4),
y: 30 * Math.sqrt(i) * Math.sin(i * 2.4),
_community: n.community, _community_name: n.community_name,
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
}})));