From 75070453518cc806a9f7525f0a269aac051e397e Mon Sep 17 00:00:00 2001 From: Sentinel-Bluebuilder Date: Sun, 21 Jun 2026 13:20:39 -0700 Subject: [PATCH 1/2] feat: optimistic UI updates with chain-truth reconciliation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a mutating action (link/unlink node, add subscriber, register provider) the operator had to wait out the read-cache TTL plus chain indexing before the change appeared — "added nodes show after a big delay", "subscriber count stale", etc. Frontend: apply the change optimistically, then reconcile against chain truth on a short delay and on a bounded retry schedule, so the UI is instant but self-corrects if the chain disagrees. - optimisticThenReconcile(url, { mutate, render, page }) — generic optimistic-then-refetch wrapper - reconcileProviderViews / reconcilePlanNodes / reconcileSubscriberViews — view-specific reconcilers with backoff (attempts/baseMs) - seedYourNodesWithAdded — show just-linked nodes immediately in Your Nodes Backend: invalidate the operator-scoped read caches the moment a sub lands so the reconcile refetch sees fresh data instead of a 30-120s stale snapshot. - invalidateSubscriberCaches(planId) drops planMembers/ownSub/planStats/ uniqueWallets for the operator - called on subscribe, add-subscriber, and add-subscribers success - getUniqueWallets wrapped in cached() (120s TTL) so its key exists to be invalidated and the up-to-10k subscription query stops re-firing on every plan detail view --- public/index.html | 320 ++++++++++++++++++++++++++++++++++++++++------ server.js | 30 +++++ 2 files changed, 308 insertions(+), 42 deletions(-) diff --git a/public/index.html b/public/index.html index 2ac4cde..f46ba0f 100644 --- a/public/index.html +++ b/public/index.html @@ -5456,7 +5456,7 @@

View on Desktop