Fork me on GitHub
#fulcro
<
2021-09-21
>
Björn Ebbinghaus12:09:27

@tony.kay Given the db with a "loose edge":

{:current-locale [:locale :en]}
And the query:
(defsc Locale [_ _]
  {:query [:locale :translations]
   :ident :locale})

(defsc Root [_ props]
  {:query [{:current-locale (comp/get-query Locale)}]}
  (:current-locale props))
This gives me the [:locale :en] although I expected nil. Like I would if I did (get-in db [:locale :en]) Is there a reason for this behavior? Fulcro knows [:locale :en] isn't "real data" based on the ident of Locale, so it can differentiate between an edge leading nowhere and a vector of data, doesn't it?

tony.kay15:09:16

so you have no initial state here...the db should be empty

tony.kay15:09:26

so you're not showing the whole code I suspect

tony.kay15:09:51

If you put something that looks like an ident (vector of 2, kw first) and ask fulcro to resolve a join, then it will resolve it as a join. That is how it figures out what is an ident and what is a prop....if you query for [:current-locale]` you get exactly what is at that key in the db (even if it is an ident), but if you query with a join and it looks like an ident, it will follow it.

👍 1
tony.kay15:09:46

So, I would expect nil if you gave no initial state, because there should be nothing to query, but it seems your db is not empty?

Björn Ebbinghaus18:09:49

There is something in the db, you are right. I didn't saw it in my console because it is not reachable from my root query.

{:current-locale [:locale :en]
 :locale {:de {:locale :de, :translations ...}