Status: done Completed: 2026-02-18 Priority: P1 Created: 2026-02-18 Owner: conductor
ui_routing2.cljc stores URL sync state in module-level defonce atoms (lines 631-634):
(defonce ^:private url-sync-handlers (atom {})) ;; session-id -> handler fn
(defonce ^:private url-sync-child-to-root (atom {})) ;; child-sid -> root-sid
This means ALL Fulcro app instances share URL sync state. For headless testing with multiple simulated browser sessions (or multiple apps), each app must own its URL sync state independently. The state should live in the Fulcro runtime atom, following the existing pattern used by ::sc/env (see fulcro.cljc:305).
Store URL sync state in the Fulcro app's runtime atom under ::url-sync:
{::url-sync {:handlers {session-id handler-fn}
:child-to-root {child-sid root-sid}}}
Add helper functions for accessing/updating:
(url-sync-state app) — reads ::url-sync from runtime atom(swap-url-sync! app f & args) — updates ::url-sync in runtime atomRemove the 2-arity url-sync-on-save (breaking change). All callers must use the 3-arity form (url-sync-on-save session-id wmem app). The 2-arity cannot determine which app to look in. This is a clean break — the 3-arity already exists and is the recommended form.
Update 3-arity url-sync-on-save to read handlers from the app's runtime atom.
Update install-url-sync! to register/deregister handlers in the runtime atom.
Update find-root-session to read child-to-root cache from the app's runtime atom. It already receives state-map so needs the app passed through or the cache looked up from state-map.
Update cleanup function to clear from runtime atom.
Remove the module-level defonce atoms.
integration/fulcro/ui_routing2.cljc — url-sync-handlers, url-sync-child-to-root, url-sync-on-save, install-url-sync!, find-root-sessionReplace @url-sync-handlers reads with (-> (url-sync-state app) :handlers) and swap! calls with (swap-url-sync! app ...). The find-root-session function already receives state-map so it can look up the handlers. Thread app through where needed.
install-url-sync! registers handler in runtime atom (not global)url-sync-on-save 3-arity reads handlers from correct app's runtime atomurl-sync-on-save 2-arity is removed; callers updated to 3-aritydefonce atoms are removedurl-sync-on-save (already does — line 39 of app.cljs)Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |