Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +2 -13
templates/index.html
CHANGED
|
@@ -537,14 +537,7 @@ body.light .dropdown-section kbd { background: rgba(0,0,0,0.04); border-color: r
|
|
| 537 |
</style>
|
| 538 |
|
| 539 |
<script>
|
| 540 |
-
|
| 541 |
-
// OVER THINKER — Browser Memory Fixes
|
| 542 |
-
// - Fix 1: addOptions() now replaces children instead of appending
|
| 543 |
-
// - Fix 2: Zoom handler cleanup on initSvg (prevents listener leaks)
|
| 544 |
-
// - Fix 3: Data arrays cleared before each render (via removeChildrenOf + keyed joins)
|
| 545 |
-
// - Fix 4: D3 exit().remove() already present with keyed data bindings
|
| 546 |
-
// All other features preserved: full UI, path sidebar, export, upload trace
|
| 547 |
-
// =============================================
|
| 548 |
|
| 549 |
let nodes = [];
|
| 550 |
let links = [];
|
|
@@ -742,7 +735,6 @@ function initSvg() {
|
|
| 742 |
}
|
| 743 |
|
| 744 |
function renderCanvas() {
|
| 745 |
-
// Memory Fix 3: No stale data accumulation — tree is rebuilt via removeChildrenOf/add options
|
| 746 |
computeTreeLayout();
|
| 747 |
initSvg();
|
| 748 |
updateLinks();
|
|
@@ -756,7 +748,6 @@ function renderCanvas() {
|
|
| 756 |
}
|
| 757 |
|
| 758 |
function updateLinks() {
|
| 759 |
-
// Memory Fix 4: D3 keyed data join with exit().remove() already correct
|
| 760 |
const linkJoin = gLinks.selectAll('line').data(links, d => {
|
| 761 |
const sid = typeof d.source === 'object' ? d.source.id : d.source;
|
| 762 |
const tid = typeof d.target === 'object' ? d.target.id : d.target;
|
|
@@ -1089,12 +1080,10 @@ async function exploreNode(nodeId, count, comment) {
|
|
| 1089 |
} finally { hideLoading(); }
|
| 1090 |
}
|
| 1091 |
|
| 1092 |
-
// Memory Fix 1: addOptions now removes existing children first (replace instead of append)
|
| 1093 |
async function addOptionsToNode(nodeId, count) {
|
| 1094 |
showLoading('Adding new options...');
|
| 1095 |
try {
|
| 1096 |
-
//
|
| 1097 |
-
removeChildrenOf(nodeId);
|
| 1098 |
const data = await apiPost('/add_options', { node_id: nodeId, count });
|
| 1099 |
const newChildren = data.children || [];
|
| 1100 |
newChildren.forEach(child => addNodeToGraph(child, nodeId));
|
|
|
|
| 537 |
</style>
|
| 538 |
|
| 539 |
<script>
|
| 540 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 541 |
|
| 542 |
let nodes = [];
|
| 543 |
let links = [];
|
|
|
|
| 735 |
}
|
| 736 |
|
| 737 |
function renderCanvas() {
|
|
|
|
| 738 |
computeTreeLayout();
|
| 739 |
initSvg();
|
| 740 |
updateLinks();
|
|
|
|
| 748 |
}
|
| 749 |
|
| 750 |
function updateLinks() {
|
|
|
|
| 751 |
const linkJoin = gLinks.selectAll('line').data(links, d => {
|
| 752 |
const sid = typeof d.source === 'object' ? d.source.id : d.source;
|
| 753 |
const tid = typeof d.target === 'object' ? d.target.id : d.target;
|
|
|
|
| 1080 |
} finally { hideLoading(); }
|
| 1081 |
}
|
| 1082 |
|
|
|
|
| 1083 |
async function addOptionsToNode(nodeId, count) {
|
| 1084 |
showLoading('Adding new options...');
|
| 1085 |
try {
|
| 1086 |
+
// removeChildrenOf(nodeId);
|
|
|
|
| 1087 |
const data = await apiPost('/add_options', { node_id: nodeId, count });
|
| 1088 |
const newChildren = data.children || [];
|
| 1089 |
newChildren.forEach(child => addNodeToGraph(child, nodeId));
|