Status: done Completed: 2026-02-18 Priority: P1 Created: 2026-02-18 Owner: AI
ui_routing2.cljc was designed to support multiple independent routing statecharts by
parameterizing the session ID throughout its public API. However, this generality is
unnecessary:
istate child charts don't surface session IDs to users — send-to-self!
looks up the child session internally from the parent session's data; user code never
sees child session IDs via the public API.The result is gratuitous boilerplate at every call site. ui-routes.cljc correctly used a
well-known ::session constant, and ui-routing2 should do the same. The older ui-routes
API shape is the right model; ui-routing2 adds real value through deep busy? checking,
cross-chart :route/reachable transitions, and decoupled URL sync — not through session-id
parameterization.
(def session-id
"The well-known statechart session ID used for the routing statechart."
::session)
| Current signature | New signature |
|---|---|
(route-to! app session-id target) | (route-to! app target) |
(route-to! app session-id target data) | (route-to! app target data) |
(ui-current-subroute this session-id factory-fn) | (ui-current-subroute this factory-fn) |
(active-leaf-routes app-ish session-id statechart-id) | (active-leaf-routes app-ish) |
(route-denied? app-ish session-id) | (route-denied? app-ish) |
(force-continue-routing! app-ish session-id) | (force-continue-routing! app-ish) |
(abandon-route-change! app-ish session-id) | (abandon-route-change! app-ish) |
(send-to-self! this routing-session-id event) | (send-to-self! this event) |
(send-to-self! this routing-session-id event data) | (send-to-self! this event data) |
(current-invocation-configuration this routing-session-id) | (current-invocation-configuration this) |
(start! app session-id statechart-id statechart) | (start! app statechart) |
(install-url-sync! app session-id statechart-id & opts) | (install-url-sync! app & opts) |
url-sync-on-save signature unchangedIt receives [session-id wmem app] as a framework callback — the session-id comes from
the :on-save hook, not from user code. No change needed.
Remove all mention of session-id parameters from public function docstrings.
Update routing_regions and related docstrings to reflect the simpler API.
Create src/routing-demo2/ (or update existing routing-demo) to demonstrate ui-routing2
with the simplified API. Add a :routing-demo2 build to shadow-cljs.edn.
The demo should show: basic routing, guarded transitions (busy form), cross-chart routing
via :route/reachable, and URL sync via install-url-sync!.
The routing section (line ~1040+) references ui-routes. Update it to reference ui-routing2
and show the current API. Remove any mention of session-id as a user-visible concern.
src/main/com/fulcrologic/statecharts/integration/fulcro/ui_routing2.cljc — main refactoringsrc/routing-demo2/ — new or updated demo (to be created)shadow-cljs.edn — add :routing-demo2 builddeps.edn — add src/routing-demo2 to source pathsGuide.adoc — update routing sectionsession-id constant and update all public functions to use it internallysession-id / routing-session-id parameter from each public function,
replacing references to it with the constantui-routing2 API(def session-id ::session) is defined in ui_routing2.cljcurl-sync-on-save signature is unchangedrouting-demo2 compiles without warnings under shadow-cljsui-routing2 and shows correct APICan 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 |