Fork me on GitHub

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])


Right: Query has to match data input.


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.


There is only “one rule”


initial state: Your tree has to match your query…`:x` in the query, :x in the 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.

Adrian Smith09:04:37

just noticed the fulcro RAD book last night I was blown away by the amount of documentation there

Jakub Holý (HolyJak)13:04:45

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

eccentric J15:04:40

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)


@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

eccentric J17:04:56

Also created a PR against the guide to bump the version and explain that.


well that warning isn't always true. it was just for this version ...


normally things just work but in this case it is the interop from shadow-cljs -> clojurescript -> closure-compiler that all need to align 😛

eccentric J18:04:13

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 😕

eccentric J18:04:59

I see, created a new PR to only bump the version then.

eccentric J15:04:06

Ah thanks! Will fix.