This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-06
Channels
- # aleph (70)
- # announcements (9)
- # babashka (43)
- # babashka-sci-dev (6)
- # beginners (97)
- # cider (2)
- # clj-commons (3)
- # clj-kondo (41)
- # clojure (88)
- # clojure-europe (44)
- # clojure-nl (2)
- # clojure-spec (22)
- # clojurescript (65)
- # community-development (6)
- # conjure (10)
- # cursive (6)
- # datahike (13)
- # datomic (4)
- # eastwood (11)
- # events (1)
- # fulcro (45)
- # graalvm (1)
- # graphql (3)
- # hyperfiddle (3)
- # integrant (7)
- # jobs (1)
- # lambdaisland (1)
- # lsp (58)
- # nbb (4)
- # nrepl (3)
- # pathom (15)
- # shadow-cljs (27)
- # tools-deps (1)
Did anyone had success using fulcro-rad-sql with pathom3? looks like sql/wrap-env is never called with the example code in the fulcro-rad-demo fulcro3 branch
ok it was only the case when running queries within pathom viz
I've read the docs and tried to look back through chat history, but I'm still not not clear how to make sure that ::merge/not-found
isn't passed to my components.
• df/load!
loads data from server has many fields that may be nil
• I see from the transit response those nil values are being sent (I am using pathom/elide-special-outputs-plugin
, if that matters)
• In the client db, I see that value ::merge/not-found
• When a component queries that attribute from the db it gets ::merge/not-found
and doesn't get nil, which is what I really want to get.
I really want to get nil when I query those attribute from a component.. So my first question is - am I doing something wrong? I see reference to sweep-merge
, which is supposed to remove these values. When should this be called? Could I be doing something to cause it not run correctly?
If I'm not doing something wrong and it's expected that not-found propagates to the UI if I don't do anything, I can:
• Call nillify-not-found
from my components every time access the value. (YUCK)
• Be diligent on the server to never return nil. (mostly works, but this really isn't the data I want to be sending)
• Do something in pre-merge
for every load event I'm concerned about. I'm also not clear, based on the examples, what the "correct" behavior is. I can write things that look like they are doing what I want, but I'm not entirely clear. Is there a clear example of what to do? None of the examples in the book seem like what I want.
you do not want nil
in app state if you can avoid it. Not founds are retracted, not set to nil
where are you seeing not-found values? pre-merge
? They are supposed to be there, because you might find them useful.
Fulcro is very pluggable…so, first question would be if you’re doing anything non-stock
but yes, it is supposed to be visible in pre-merge. The sweep-merge happens after pre-merge
they are there so that a merge of various layers in pre-merge
will work “right” semantically
I'm not doing any special configuration that I can see in initializing the app that would add any extra middleware or do anything unusual
So, confirm that you are seeing the not-found
values in the client db after load is done, and you look at db in Inspect
This is an odd corner case, and in practice you should never return nils in maps from EQL requests. nil
is not considered a legal value from a data perspective in Fulcro (the absence of the key is the proper way to indicate no value for a key). You can easily put a plugin on pathom that will dissoc keys w/nil values.
That said, I would consider it a bug if a nil
is returned and the not-found
marker ends up in app state
and to confirm it is sending nil... I do have elide-special-outputs-plugin on the server side
:query [{:project-parent/proposal
[:proposal/design-name
:proposal/estimate
:proposal/faqs
:proposal/team-members
:proposal/timeline
:proposal/what-we-heard]}]
The internals assume you’re always going to do joins on components that themselves have queries.
the fact that you are not normalizing the nested item is what is confusing it I think
Ah - so if I were put this on the parent entity and used :focus (or whatever the keyword is to target only some sub-query) for example, then fulcro would be happy
I’m not sure why it is breaking on that…I’m looking at the internal logic and I don’t see a problem
if it was a flat query then it would work. Also, it would work if you had:
:query [{:project-parent/proposal (comp/get-query Proposal)}]
where Proposal queried for an id and had an ident and therefore was normalizedHmm - this data doesn't have an ident, though I suppose I could borrow the id of the parent object....
unless you need true recursion, in which case
(defsc Proposal [this props]
{:query [:proposal/id {:proposal/parent ...}]
:ident :proposal/id}
...)