Fork me on GitHub
#fulcro
<
2020-10-19
>
xceno10:10:58

Just to clarify: When I route to a form like this. The :pre-merge hook will run when the component is initialized by the router. So for example on page load. So instead, I should call (fs/add-form-config) in the`:post-mutation` hook of :will-enter. Is that correct? I'm asking because what I observe right now, is that I only end up with a single form with my initial-state, because :pre-merge runs only once on page load.

njj11:10:33

I’ve always done fs/add-form-config* in the post mutation. For example, fetch some thing via df/load, then in the post-mutation have something like edit-your-data mutation that threads fs/add-form-config* into the state.

xceno11:10:22

Alright thanks! That's exactly what I'm doing now.

(defmutation NodeWillEnter [{:keys [target]}]
  (action [{:keys [app state]}]
    (swap! state (fn [s] (-> s
                           (fs/add-form-config* SelectedNode target)
                           (assoc-in [::SelectedNode] target))))
    (dr/target-ready! app target)))
Seems to work well for now

daemianmack13:10:22

i'm using fulcro 2.8.13 in a web-app that composes many small Fulcro apps. is it possible, given a handle to a mounted Fulcro app (i.e., the return value of fulcro.client/make-fulcro-client) to query into its normalized data, from an external (non-Fulcro) context?

daemianmack14:10:28

i see i can get access to the internal DB state atom by passing the app's :reconciler to fulcro.client.primitives/app-state -- that should work well enough for my purposes (something of a temporary migration-phase bridge between fulcro-land and other, that won't last very long)

tony.kay14:10:12

right: db->tree on reconciler

👍 3