Status: done Priority: P1 Created: 2026-02-21 Owner: AI Depends-on: none
fops/load ok-action callback doesn't fire in headless mode. Report E2E tests manually send :event/loaded as a workaround. The data arrives in Fulcro state via auto-merge, but the statechart stays in :state/loading because the ok-action callback (which sends the statechart event) never fires.
:immediate mode?../statecharts/ or in fulcro-rad-statecharts):event/loaded workaround from report E2E tests:state/loading to :state/ready automatically after load completesfops/load definition: ../statecharts/operations.cljc:42-61 — returns {:op :fulcro/load ...} data maprun-fulcro-data-op! :fulcro/load: ../statecharts/fulcro_impl.cljc:325-353 — creates ok-action closure that calls sp/send!src/demo/com/example/headless_report_tests.clj:60-75 — wait-for-report! manually sends :event/loadedsrc/main/com/fulcrologic/rad/application.cljc:118-137 — install-statecharts! with :event-loop? :immediateThe ok-action callback chain works correctly — sp/send! fires, drain-events! runs, and process-events! transitions the statechart to #{:state/ready}. The actual bug was in report_expressions.cljc's process-loaded-data-expr:
(fops/apply-action (constantly updated)) captured a snapshot of the entire Fulcro state-map during expression evaluation (inside process-event!, before save-working-memory!). When the deferred transact!! executed do-apply-action, it replaced the entire state including statechart working memory, overwriting #{:state/ready} back to #{:state/loading}.
Fix: Changed to a transform function that applies changes at swap-time:
(fops/apply-action (fn [current] (-> current (preprocess-raw-result data) (filter-rows-state data) (sort-rows-state data) (populate-page-state data))))
../statecharts/src/main/com/fulcrologic/statecharts/integration/fulcro_impl.cljc — Likely fix locationsrc/demo/com/example/headless_report_tests.clj — Remove workaround after fix:event/loaded send (3 tests, 21 assertions, 0 failures)(constantly snapshot) pattern in form codeCan 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 |