This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-28
Channels
- # announcements (11)
- # aws (2)
- # babashka (35)
- # beginners (173)
- # calva (3)
- # chlorine-clover (2)
- # cider (17)
- # clara (2)
- # clj-kondo (28)
- # cljs-dev (11)
- # cljsrn (53)
- # clojure (178)
- # clojure-argentina (1)
- # clojure-europe (12)
- # clojure-germany (5)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (25)
- # clojure-uk (88)
- # clojurescript (109)
- # conjure (34)
- # cursive (2)
- # data-science (35)
- # datomic (15)
- # emacs (6)
- # events (1)
- # fulcro (28)
- # graphql (15)
- # helix (21)
- # hoplon (7)
- # jobs (4)
- # jobs-discuss (1)
- # joker (15)
- # lambdaisland (1)
- # lein-figwheel (4)
- # local-first-clojure (1)
- # malli (8)
- # meander (17)
- # off-topic (33)
- # parinfer (2)
- # rdf (16)
- # re-frame (3)
- # reagent (21)
- # reitit (14)
- # remote-jobs (5)
- # ring (8)
- # rum (1)
- # shadow-cljs (184)
- # sql (2)
- # testing (1)
- # tools-deps (23)
I’m really puzzled by merge/merge-component!
, I keep calling it in repl, but nothing seems to be happening…
I’ve tried this:
(merge/merge-component! app/SPA ShareListItem msg)
and this:
(merge/merge-component! app/SPA ShareListItem msg :replace [:component/id :share-list :share-list/shares])
The df/load!
which works is this:
(df/load! app/SPA :all-shares ShareListItem {:target [:component/id :share-list :share-list/shares]})
So I expected one of them to be similar to the other? But it very much doesn’t appear to be…
Figured it out, turns out that for merge-component!
, I need to unnest the value:
(merge/merge-component! app/SPA ShareListItem (:all-shares msg) :replace [:component/id :share-list :share-list/shares])
I do feel that small things like this really do trip beginners up, I’m trying to document what I can =)… But I’m really aware that I still only have a limited understanding of the system in depth…
I would say this is just part of the learning process. When you dig into Fulcro, you get used to working with normalized data and thinking in those terms. Then as you get more comfortable and try more things, you inevitably will need to use merge-component, which requires raw (denormalized) data. It can be a bit disorienting at first, I remember going through something similar when I first started. It goes away quickly. If anything, take it as a sign that you are on the right track with your learning because you are getting used to thinking in terms of normalized data, which is what you should be doing about 90% of the time. So, congrats? 😄
BTW, same thing with pre-merge. I think those are the 2 main exceptions to the rule. Oh and initial state.
I get that, but it would be useful to have some of those things being made clearer in stages? So for example, it took me a fair while to work out that I should be passing in :replace
, the only other option I know of that can also go there is :append
. I don’t know where these are listed, I’ve just seen them used in examples and have tried them… I’m not even sure that’s the total list of options… 😃
I’m not sure what you mean by “exception to a rule”. The rule is “the tree of data has to match the query”. ShareListItem has a query, and that map has to have keys for the items in the query. load!
builds a query from a keyword and subquery, and the response has to return a tree with that key and sub-tree.
Poor choice of words, I guess. My point was that when you first start working with data, i.e. normal mutations mutating app state, you are dealing with normalized data, vs other times when you are dealing with the tree that has to match the query.
just noticed the fulcro RAD book last night I was blown away by the amount of documentation there
I think it is seriously up to date, even the fulcro-rad-demo has troubles keeping up to the changes. I believe Tony wanted to take it down for that reason, people should have a look at the demo and read docstrings while there is so much changes.
Ah, you mean out of date @U0522TWDA?
yeah, out of date…anyone familiar with demo might take a shot at updating??? I don’t have the time
the bones are right…but the examples are wrong due to a lot of renaming and refactoring cleanup. Most of the core API is stable now, and probably won’t change much. Still Alpha, though
Finally giving fulcro a shot, going through the getting started tutorial now. However, I can't seem to get shadow to build:
npx shadow-cljs server
...
Syntax error (NoSuchFieldError) compiling at (shadow/cljs/devtools/api.clj:1:1)
ES3
@jayzawrotny thats caused by a version conflict, assuming you are using project.clj/deps.edn you probably need to update the cljs version specified there
Also created a PR against the guide to bump the version and explain that. https://github.com/fulcrologic/fulcro-developer-guide/pull/46
normally things just work but in this case it is the interop from shadow-cljs -> clojurescript -> closure-compiler that all need to align 😛
Ack! Well better to catch that now than later. Will fix.
the issue only exists because of deps.edn too .. if it were just shadow-cljs.edn things would just work 😕
I see, created a new PR to only bump the version then.
Ah thanks! Will fix.