I came into a situation where are reaching for the "Fulcro Raw" but for some reason it seems the add-component! hooks don't work. I made a very small example based on the docs and it seem add-component! does not do anything:
(defonce app2 (rapp/fulcro-app {:id "raw-fulcro-hooks"}))
(def Address (rc/nc [:address/id :address/street]
{:componentName ::Address
:initial-state (fn [{:keys [id street]}] {:address/id id :address/street street})
:ident (fn [this props] [:address/by-id (:address/id props)])}))
(def Person (rc/nc [:person/id :person/name {:person/address (rc/get-query Address)}]
{:componentName ::Person
:initial-state (fn [_]
{:person/id 10
:person/name "Bob"
:person/address (rc/get-initial-state Address
{:id 20
:street "111 Main"})})}))
(rapp/add-component! app2 Person {:initialize? true
:keep-existing? true
:receive-props (fn [props]
(js/console.log "RECEIVE PROPS")
(js/console.log props))} )
;; prints Receive PROPS
(merge/merge-component! app2 Address {:address/id 20
:address/street "wow"})
;; Prints nothing
(rapp/current-state app2)
;; =>
;;{:address/by-id {20 {:address/id 20, :address/street "wow"}},
;; :person/id
;; {10
;; {:person/id 10,
;; :person/name "Bob",
;; :person/address [:address/by-id 20]}}}Make the file CLJC and try it in a CLJ REPL…curious what you find
Interesting it works in a clj repl
ok, so that’s interesting
it may be I never tested it in CLJS facepalm
If you have any tips I am happy to test out in CLJS
but not sure off the top of my head what it could be…the diffs should be subtle if any
BTW, long-time no see, how ya been?
Very good, how are you? I am still working at Avisi and having fun 😄
doing pretty well. Busier (in a more chaotic way) than I used to be, but have good luck in general.
On this bug: I usually do a :local/root in deps or just make new cards in the fulcro repo itself and trace through the code. There’s not much to the overall render pipeline, so it should be relatively easy to uncover
I'll take a stab at it then
thanks
Btw really love this API since we need to integrate with very custom Atlassian react stuff
Glad to hear it’s useful in addl contexts. The original target was CLJ without React as an experiment…
which explains the potential lack of testing in CLJS…though MOST of the code is original (moved from the non-raw ns and referred to from there)
my guess is that something in raw.application is different
I found the issue, apparently in this instance where need to run in a sandboxed js env in a browser they define js/requestAnimationFrame but it never calls the callback
So no bug on Fulcro's side
thanks for letting me know
you’re saying you see no props?
Anyone else seeing dynamic router 3.8.3 with fulcro 3.8.3. Wondering if I have something misconfigured.
?
don’t understand your question at all
I think this is a user error. Sorry for the bother.