fulcro

danieroux 2025-07-06T17:29:27.731059Z

I feel like I'm missing something. We have a situation where the incoming data was marked as not-found (correctly), and then merge* does not sweep.

danieroux 2025-07-06T17:29:47.751779Z

(def person-id (random-uuid))
(def person-ident (comp/get-ident Person {:person/id person-id}))

(defsc Person
  [this props]
  {:ident :person/id
   :query [:person/id
           :person/name
           {:person.preferences/latest [:person.preferences.likes/pizza?]}]})

(let [state-map   {:person/id {person-id {}}}
      query       [{person-ident (comp/get-query Person)}]
      result-tree {person-ident
                   {:person/name               :com.fulcrologic.fulcro.algorithms.merge/not-found ; Sweeps ✅
                    :person/surname            "Doe"
                    :person.preferences/latest {:person.preferences.likes/pizza?
                                                ; Expect this to be sweeped?
                                                :com.fulcrologic.fulcro.algorithms.merge/not-found}}}]
  (com.fulcrologic.fulcro.algorithms.merge/merge*
    state-map
    query
    result-tree))

danieroux 2025-07-06T17:31:25.825409Z

We get

{:person/id {#uuid"e8b276ae-bf49-4b92-a4ab-87bebfdaa01f" {:person/surname "Doe",
                                                          :person.preferences/latest {:person.preferences.likes/pizza? :com.fulcrologic.fulcro.algorithms.merge/not-found}}}}

tony.kay 2025-07-08T18:33:23.121519Z

did you figure it out?

danieroux 2025-07-08T18:36:49.452059Z

Not yet, I thought it was because the join was incomplete, and that this (shape) would work:

(defsc PersonPreferences
  [this props]
  {:query [:person.preferences.likes/pizza?]})

(defsc Person
  [this props]
  {:ident :person/id
   :query [:person/id
           :person/name
           {:person.preferences/latest (comp/get-query PersonPreferences)}]})
It does not seem to, :person.preferences.likes/pizza? remains unsweeped

tony.kay 2025-07-08T18:53:38.014009Z

unsweeped when?

tony.kay 2025-07-08T18:53:47.055739Z

on a load, or just on your manual call

tony.kay 2025-07-08T18:54:00.870279Z

you have to use merge-component! or load! if you want Fulcro to sweep I think

danieroux 2025-07-08T19:02:57.414319Z

I still have to unpack the pieces to give a clear answer and decent repro. This is a load! - and I am currently suspicious that we are doing something too-funky that breaks it

tony.kay 2025-07-07T13:38:42.348159Z

you HAVE to use get-query ….you cannot make a manual join like that in sample code. try (mege* state-map (comp/get-query Person) person-map)

tony.kay 2025-07-07T13:39:14.286479Z

oh wait

tony.kay 2025-07-07T13:39:38.185669Z

what you are showing is right…sweep happens in a later stage of the load logic I think

tony.kay 2025-07-07T13:40:08.991549Z

I’d have to look at the logic again, but you can look at the source where the mark/sweep is implemented