reagent-project/reagent-forms

Update form when atom is replaced?

Open

#107 geöffnet am 14. Juni 2016

Auf GitHub ansehen
 (7 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)HTML (78 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (337 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

I believe I'm hitting similar behavior to a few of the other issues, but it's quite unclear how to resolve.

I have a form as so:

(defn some-form [foo] 
   (let [doc (r/atom {:bar (:bar foo)])
     (fn []
         [bind-fields some-form-template doc])))

The issue is, when some-form is re-rendered (because a level above it is reacting to @\foo), the form does not seem to re-render. (If I throw in a some text field reacting to @\doc here, the text field will update)

What is the proper way to handle this? It's not quite that I am updating the atom externally, it's that I'm asynchronously loading the data that goes into the atom. I want to replace it entirely.

Contributor Guide