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: compose back-to-back updateParams patches by advancing the params ref (#3313)
[._.]/ Adam Eivy38f33fa0302e
diff --git a/client/src/hooks/useUrlParams.js b/client/src/hooks/useUrlParams.jsindex 4d348ee01e..d13b0d5401 100644--- a/client/src/hooks/useUrlParams.js+++ b/client/src/hooks/useUrlParams.js@@ -37,6 +37,12 @@ export default function useUrlParams() {if (v == null || v === '') next.delete(k);else next.set(k, v);}+ // Advance the ref before navigating so two patches fired back-to-back in+ // one tick compose instead of the second clobbering the first — the router+ // hasn't re-rendered yet, so `paramsRef.current` would still be pre-patch.+ // The next render reassigns it from the router, so an optimistic value can+ // never persist past the navigation it anticipates.+ paramsRef.current = next;setParamsRef.current(next, { replace });}, []);diff --git a/client/src/hooks/useUrlParams.test.jsx b/client/src/hooks/useUrlParams.test.jsxindex 250d4bd1ee..fee00d28d2 100644--- a/client/src/hooks/useUrlParams.test.jsx+++ b/client/src/hooks/useUrlParams.test.jsx@@ -94,6 +94,20 @@ describe('useUrlParams', () => {expect(result.current.location.search).toBe('');});+ it('composes two patches fired back-to-back in one tick', () => {+ // The router has not re-rendered between the two calls, so the second must+ // not clone a pre-first-patch snapshot and drop the key the first just set.+ const { result } = renderWithRouter('/x?a=1');+ act(() => {+ result.current.pair[1]({ b: '2' });+ result.current.pair[1]({ c: '3' });+ });+ const p = params(result);+ expect(p.get('a')).toBe('1');+ expect(p.get('b')).toBe('2');+ expect(p.get('c')).toBe('3');+ });+it('keeps updateParams referentially stable across param changes', () => {// Effects that list `updateParams` as a dependency (the debounced `?q=`// mirrors in Catalog/MediaCollections) must not re-arm every time an