Skip to content

Commit a3d9fbf

Browse files
Fix Your Nodes not refreshing after add/remove (#11)
The Add Nodes and batch-unlink success handlers invalidated the /api/all-nodes cache but then called renderYourNodes(), which only re-renders the stale in-memory snapshot (S._yourNodes) without issuing a new fetch. Result: a just-added node didn't appear on Your Nodes (and a just-removed node lingered) until the user navigated away and back or the 60s SWR cache lapsed. Call loadYourNodes() instead so the page refetches the cache-invalidated /api/all-nodes?...inPlanOnly list and reconciles with chain truth immediately. Mirrors how the Add Nodes page already calls loadMgrNodes(). Backend was always correct (getNodesForPlan is a live RPC query); this is purely a client refresh fix. Co-authored-by: Sentinel-Bluebuilder <Sentinel-Bluebuilder@users.noreply.github.com>
1 parent 7056073 commit a3d9fbf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

public/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10235,7 +10235,10 @@ <h3 id="securityFaqTitle">
1023510235
// refetch the server-excluded list so chain truth reconciles — covers
1023610236
// added nodes that weren't on the current page / in S.mgrNodes.
1023710237
if (S.page === 'add-nodes') { renderAddNodes(); loadMgrNodes(); }
10238-
if (S.page === 'your-nodes') renderYourNodes();
10238+
// Your Nodes reads /api/all-nodes?...inPlanOnly — its cache was just
10239+
// invalidated above, but renderYourNodes() only re-renders the stale
10240+
// in-memory snapshot. Refetch so the just-added nodes actually appear.
10241+
if (S.page === 'your-nodes') loadYourNodes();
1023910242
refetchMyPlans();
1024010243
} else {
1024110244
toast(friendlyError(d.error || d.rawLog), 'error');
@@ -10286,7 +10289,10 @@ <h3 id="securityFaqTitle">
1028610289
if (S.mgrPlanId) invalidateCache('/api/plans/' + S.mgrPlanId);
1028710290
invalidateCache('/api/my-plans');
1028810291
if (S.page === 'add-nodes') renderAddNodes();
10289-
if (S.page === 'your-nodes') renderYourNodes();
10292+
// Refetch (not just re-render) so the removed node actually drops off
10293+
// Your Nodes — the cache was invalidated above but the in-memory snapshot
10294+
// still holds it.
10295+
if (S.page === 'your-nodes') loadYourNodes();
1029010296
refetchMyPlans();
1029110297
} else {
1029210298
toast(friendlyError(d.error || d.rawLog), 'error');

0 commit comments

Comments
 (0)