This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-25
Channels
- # anglican (2)
- # babashka (53)
- # beginners (99)
- # brompton (1)
- # calva (28)
- # circleci (43)
- # clj-commons (4)
- # clj-kondo (176)
- # cljsrn (22)
- # clojars (7)
- # clojure (175)
- # clojure-australia (2)
- # clojure-europe (20)
- # clojure-germany (1)
- # clojure-uk (5)
- # clojurescript (195)
- # cursive (18)
- # datomic (13)
- # emacs (2)
- # farolero (9)
- # find-my-lib (6)
- # fulcro (8)
- # graalvm (12)
- # gratitude (5)
- # helix (11)
- # improve-getting-started (36)
- # introduce-yourself (3)
- # jackdaw (21)
- # jobs (2)
- # joker (2)
- # malli (65)
- # meander (24)
- # nbb (2)
- # off-topic (4)
- # pathom (2)
- # polylith (17)
- # portal (5)
- # react (3)
- # reagent (22)
- # releases (1)
- # ring (4)
- # shadow-cljs (79)
- # show-and-tell (2)
- # testing (5)
- # tools-deps (9)
- # xtdb (12)
In a Fulcro RAD form, you can get access to :ui/current-rows
, which is a vector of maps (“denormalized form?“) — [{:trello-card/id 123, :trello-card/name "abc"}].
I can then map over this a stateful component — e.g., map component-ui current-rows
.
OTOH, when I try to access loaded-data
or filtered-rows
, they’re a vector of idents (e.g., [[:trello-card/id 123]]
. How do I turn this into a vector of maps like current-rows
from within the RAD form? (No access to state, can’t use denormalize.)
Thank you!
I do not see loaded-data
in the actual props. There is :cache :filtered-rows
, which is a vec of idents, as you said. In the client DB there is :ui/loaded-data
.
You could do this to get denorm. loaded data (provided your component is named ComponentName
and you don't use a custom BodyItem):
ro/query-inclusions [{:ui/loaded-data (comp/get-query (comp/registry-key->class ::ComponentName-Row))}]
But it does not look as the optimal solution. Could you explain a little why you need this? Perhaps whatever you are trying to do should rather be done in the UISM and not in the component?Hi @tony.kay! Both me and @genekim arrived independently at the need to have RAD report input controls that are set via route params and not displayed in the UI for the user. Would it make sense to add support for this into RAD?
One solution is to exclude such controls from ro/control-layout
but RAD then logs warnings. What I did was to https://github.com/holyjak/fulcro-billing-app/blob/main/src/shared/billing_app/ui_utils/rad_controls.cljc#L108`:hidden`https://github.com/holyjak/fulcro-billing-app/blob/main/src/shared/billing_app/ui_utils/rad_controls.cljc#L108 which I then https://github.com/holyjak/fulcro-billing-app/blob/main/src/shared/billing_app/ui/billing/ui.cljc#L115. Alternatively, and perhaps most user-friendly, we could extend RAD to respect :hidden? true
on the control definition map and modify the check of control-layout
to not want about these. What do you think? I'd be happy to send a PR.
Yes, that is the intended behavior (elided from control layout). The reason for the warnings is so that you can figure out you missed putting them in the layout when they are missing, so I like your solution of adding a hidden/visible flag… Here’s where that check would go for reports: https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/develop/src/main/com/fulcrologic/rad/rendering/semantic_ui/report.cljc#L139 and here is how it is implemented for form fields (generic wrapper): https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/form.cljc#L1113
so, I’d prefer visible?
, since that is what I use in forms, and that could be namespaced to controls (https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/control_options.cljc) or I guess it could also just be non-namespaced, but I should have made all of the controls support “documented” options.
OK, thank you! I will look into it.