Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: treat an empty Quota Burn stash as no restore (#3933)
[._.]/ Adam Eivy7e4d4f6ad8cb
diff --git a/client/src/pages/QuotaBurn.jsx b/client/src/pages/QuotaBurn.jsxindex f3134a38a4..836687c82f 100644--- a/client/src/pages/QuotaBurn.jsx+++ b/client/src/pages/QuotaBurn.jsx@@ -47,10 +47,12 @@ const UNSAVED_PATCH_KEY = 'quotaBurn:unsavedPatch';// A stash written by an older build (or hand-edited) must not be replayed as a// patch — the PUT body is an object, and anything else would 400 the save the-// restore is supposed to rescue.+// restore is supposed to rescue. An object with no keys is equally not a+// restore: replaying it would PUT nothing and still announce recovered edits.const readStashedPatch = () => {const stored = safeReadJsonSession(UNSAVED_PATCH_KEY);- return stored && typeof stored === 'object' && !Array.isArray(stored) ? stored : null;+ const isPatch = stored && typeof stored === 'object' && !Array.isArray(stored) && Object.keys(stored).length > 0;+ return isPatch ? stored : null;};// Distinguishes a read that THREW from one that resolved with nothing — the@@ -301,6 +303,10 @@ export default function QuotaBurn() {// truth about persistence: swallowing this failure is what turned// "Saving changes…" into permanently-lost edits. Say so, and keep the// patch for the next visit — the toast is transient, the work isn't.+ // If the user is already back on the page when this rejects, the stash+ // waits for the visit AFTER this one rather than being applied live; the+ // toast still names the failure, and holding the edits is strictly better+ // than the drop this replaces..catch(() => {safeWriteJsonSession(UNSAVED_PATCH_KEY, mergeQuotaBurnPatch(readStashedPatch(), patch));toast.error('Quota Burn changes could not be saved — they will be restored next time you open the page.');diff --git a/client/src/pages/QuotaBurn.test.jsx b/client/src/pages/QuotaBurn.test.jsxindex 1c1692aa07..2044f5243a 100644--- a/client/src/pages/QuotaBurn.test.jsx+++ b/client/src/pages/QuotaBurn.test.jsx@@ -590,6 +590,15 @@ describe('QuotaBurn save races', () => {expect(api.saveQuotaBurn).not.toHaveBeenCalled();});+ it('ignores an empty stash rather than announcing a restore of nothing', async () => {+ globalThis.sessionStorage.setItem(STASH_KEY, '{}');+ renderPage();++ expect(await screen.findByText(/62% left/)).toBeInTheDocument();+ await sleep(100);+ expect(api.saveQuotaBurn).not.toHaveBeenCalled();+ });+it('names why the first load failed and recovers from the Retry button', async () => {// A failed first read used to leave a bare "the server did not return a// plan" with the header — and its Refresh — unrendered, so the only way