This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-09
Channels
- # announcements (5)
- # aws (5)
- # babashka (7)
- # beginners (152)
- # cider (10)
- # clj-kondo (30)
- # clj-on-windows (1)
- # cljs-dev (14)
- # cljsrn (19)
- # clojure (94)
- # clojure-australia (4)
- # clojure-europe (43)
- # clojure-nl (2)
- # clojure-uk (11)
- # clojurescript (16)
- # clojureverse-ops (5)
- # code-reviews (7)
- # community-development (6)
- # core-async (29)
- # cursive (50)
- # datomic (22)
- # docker (10)
- # figwheel-main (3)
- # fulcro (4)
- # graalvm (1)
- # introduce-yourself (2)
- # kaocha (9)
- # lambdaisland (2)
- # lsp (19)
- # malli (37)
- # off-topic (50)
- # polylith (8)
- # portal (1)
- # reagent (10)
- # rum (1)
- # shadow-cljs (24)
- # spacemacs (14)
- # yada (2)
In the continuing quest to modify RAD Reports to lazily load, I tried to modify the UI State Machine (UISMs), as per @tony.kay’s suggestion. And it definitely is as straightforward to as suggested, although I’m running into strange problems.
My goal was to modify the function that :event/run
calls, to add a :without #{:trello-cards/comments}
.
I first modified the state machine, as follows:
(uism/defstatemachine custom-machine
(-> com.fulcrologic.rad.report/report-machine
(assoc-in
[:com.fulcrologic.fulcro.ui-state-machines/states
:state/gathering-parameters
:com.fulcrologic.fulcro.ui-state-machines/events
:event/run
::uism/handler]
;report/load-report!)))
my-load-report!)
But when I run a function that is an exact copy of report/load-report!
, it
(defn load-report! [env]
(let [Report (uism/actor-class env :actor/report)
report-ident (uism/actor->ident env :actor/report)
{::keys [BodyItem source-attribute]} (comp/component-options Report)
current-params (report/current-control-parameters env)
path (conj report-ident :ui/loaded-data)]
(println "*** my-report-load! ")
(println " path: " path)
(println " current-params: " current-params)
(println " BodyItem: " BodyItem)
(println " source-attribute: " source-attribute)
(log/debug "Loading report" source-attribute (comp/component-name Report) (comp/component-name BodyItem))
(-> env
(uism/load source-attribute BodyItem {:params current-params
::uism/ok-event :event/loaded
::uism/error-event :event/failed
:marker report-ident
:target path})
(uism/activate :state/loading))))
The JavaScript engine hangs upon entering this.. BodyItems and source-attribute are both nil…. I’m a bit baffled, because the only thing that nothing is different than report/load-report!
except the namespace it’s in? (And the report will load as expected if I change the function in this state machine to report/load-report!
)
The last error in console is:
BodyItem: nil
core.cljs:200 source-attribute: nil
react_devtools_backend.js:2574 WARN [com.example.ui.trello-list-report:185] - Loading report null com.example.ui.trello-list-report/ListCards null
Any ideas on what could be going wrong? (Thx to @holyjak for helping me think thru this!)✅ 2
I guess the uism/actor-class returns nil? Look at the env, does it look OK?
Oh wait, change ::keys to ::report/keys (provided you required rad report ns as that)