fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2020-09-04T05:13:25.220600Z

The design is that you roll up data in resolver on server, and invent a virtual attribute for that, but you can hand render if you want

roklenarcic 2020-09-04T07:44:29.223100Z

Hm the one thing here is that if invent an attribute :project/tags ,which is aggregated tags, to put in the report, if someone edits a tag the virtual attribute won’t be refreshed automatically.

nivekuil 2020-09-04T09:23:43.223200Z

just a syntax nitpick/proposal: uism definitions seem unnecessarily noisy to me; would it make sense to be more concise/regular by inferring the top-level ::uism/events key, so it's just a map of events with a default override event to replace the current ::uism/handler functionality? e.g.

;; current syntax {::uism/events {:event/foo {::uism/handler foo}}} {::uism/handler foo} ;; more consise/regular syntax? {:event/foo {::uism/handler foo}} {::uism/all-events {::uism/handler foo}}

nivekuil 2020-09-04T13:55:05.224200Z

I noticed that having a {:query [(uism/asm-ident ::session/sm)]} will still not re-render when the uism changes state. I'm setting :shouldComponentUpdate (fn [] true) on the component anyways and that works, but from what I see, the book says that just adding the uism query should work

nivekuil 2020-09-06T18:33:59.237900Z

verdict: compose queries/initial state all the way up to the root. simple yet somehow hard

nivekuil 2020-09-04T13:57:34.225800Z

full component:

(defsc Navigation [this props]   {:query [(uism/asm-ident ::session/sm)]}   (let [state   (uism/get-active-state this ::session/sm)         authed? (= state :state/logged-in)]     (if authed?       (comp/fragment {} (dom/a {:href "/user"} "User")                      (dom/a {:href "/settings"} "settings"))       (ui-login))))

roklenarcic 2020-09-04T13:59:09.227600Z

I have found a possible issue. When calling install-ui-controls! in RAD code it will store the UI plugins in app runtime-atom under the key :com.fulcrologic.rad/controls , it’s a map of stuff like com.fulcrologic.rad.report/style->layout . But in com.fulcrologic.rad.report the code will try to find installed formatters as such `

(some-> runtime-atom deref ::type->style->formatter)
Note that it doesn’t try to find them under the :com.fulcrologic.rad/controls key… so adding these formatters into the map that gets installed by install-ui-controls! doesn’t have any effect. You need to manually swap the atom to insert them at base of runtime-atom map.

roklenarcic 2020-09-04T14:03:27.228300Z

So my client.cljs code has to look like this:

(rad-app/install-ui-controls! app sui/all-controls)
  (let [{::app/keys [runtime-atom]} app]
    (swap! runtime-atom assoc ::report/type->style->formatter
           report-formatters))
then it works… I assume this is not intended

Jakub Holý 2020-09-04T18:18:02.228800Z

I havenæt time to explore but aren't you mixing up controls and the formatting of report columns?