Fork me on GitHub
#fulcro
<
2019-05-02
>
JAtkins04:05:31

I'm trying to get remote data working, and for some reason my ident is loading data into the proper place, but when the df/load function finishes the component does not update.

JAtkins04:05:48

Loading function: (df/load this [:Editor/id id] Editor); Component :query [:Editor/id :Editor/content] :ident [:Editor/id :Editor/id] I have verified that the data goes into the global db, but the component is never re-rendered.

JAtkins04:05:54

Any ideas?

claudiu05:05:55

@U5P29DSUS Is the this you're using from the component ? Should refresh, if not worth adding a refresh with :Editor/id to df load https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/client/data_fetch.cljc#L152 similar effect to http://book.fulcrologic.com/#_follow_on_reads

claudiu05:05:20

If you can copy paste the component and parent-component (just the declaration part) would also help debug the issue 🙂

pvillegas1212:05:42

The this you are using for load might not be the one you want

JAtkins13:05:03

The component code:

(fp/defsc Editor [this {:Editor/keys [id content] :as props}]
          {:initial-state (fn [{:keys [id content]}] {:Editor/id id :Editor/content content})
           :query         [:Editor/id :Editor/content]
           :ident         [:Editor/id :Editor/id]}
  (do
    (println "editor content =" content "id =" id "allprops =" props)
    (dom/textarea :.editor-textarea
                  {:value    (if content content "")
                   :onClick  (fn [e] (println "clicked" id)
                               (df/load this [:Editor/id id] Editor))
                   :key      id})))

JAtkins13:05:20

The parent call:

(e/ui-editor {:Editor/id 1})
. There is other stuff, but it seem. Which, now that I think about it, seems to be my issue. I need to pass in data to the editor from the db, right? I guess I thought for a bit that it was like a mutable component. Will try and let you know if that fixed it for me.

claudiu13:05:19

@U5P29DSUS yep. You're parent component should compose the Editor in :query and :initial-state.