This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-17
Channels
- # announcements (10)
- # aws (10)
- # babashka (11)
- # beginners (77)
- # calva (9)
- # cider (10)
- # cljdoc (7)
- # cljs-dev (47)
- # clojure (47)
- # clojure-uk (4)
- # clojurescript (87)
- # community-development (15)
- # conjure (14)
- # core-async (25)
- # cursive (6)
- # fulcro (6)
- # helix (3)
- # joker (2)
- # nrepl (1)
- # off-topic (1)
- # pathom (9)
- # pedestal (6)
- # re-frame (22)
- # reitit (15)
- # shadow-cljs (26)
- # spacemacs (16)
- # testing (2)
- # tools-deps (12)
- # uncomplicate (10)
- # xtdb (22)
Hm if my remote returns {:my.ns/my-key nil}
then in fulcro I get :com.fulcrologic.fulcro.algorithms.merge/not-found
as value instead of nil… is there any way to return nil values for queried properties?
I ran into this recently too. I think you can customize the fulcro app to leave them, but if you just want it for one component you can use pre-merge:
(defsc TaskItem [this props]
{:query [:task/duration :task/description :task/scheduled-at :task/id]
:ident :task/id
:pre-merge (fn [{:keys [data-tree]}]
(merge
data-tree
{:task/duration
(merge/nilify-not-found (:task/duration data-tree))
:task/scheduled-at
(merge/nilify-not-found (:task/scheduled-at data-tree))}))}
hm ok… I see I have a different problem in pre-merge. The load doesn’t get fs/form-config-join
in the query, so if my pre-merge returns initial form data, it doesn’t get normalized
that makes pre-merge less useful
that's one of the uses of pre-merge, to add form config, just merge it into the tree:
(fs/add-form-config PersonForm person-tree)
http://book.fulcrologic.com/#_initializing_a_tree_of_data
Doesnt work because firm-config is not part of the load query so it does not get normalized into the tree making it throw errors