This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-23
Channels
- # beginners (93)
- # boot (3)
- # cljs-dev (5)
- # clojure (49)
- # clojure-india (8)
- # clojure-russia (1)
- # clojure-spec (4)
- # clojure-uk (37)
- # clojurescript (33)
- # cursive (4)
- # datomic (4)
- # fulcro (11)
- # graphql (1)
- # lumo (16)
- # mount (1)
- # off-topic (21)
- # onyx (2)
- # portkey (4)
- # shadow-cljs (3)
- # spacemacs (4)
- # sql (1)
- # vim (1)
i'm a little confused with form state and add-form-config* , would appreciate if someone has a minute to tell me what i'm doing wrong
i've got a form for a "Profile" entity, and a sub-form for a "ContactInfo" entity
the problem is that the helpers for dirty fields aren't picking up changes to the sub-form
From what I can tell, the ContactInfo form state was at least partly initialized, because if I call fs/dirty? using params from within that component, it works as expected. But I thought it should also be recursive if I call it on the params from the Profile component
For example, on line 20 it disables the save button if the form isn't dirty. This works fine to enable the button when I modify :profile/first-name, but it doesn't work when I modify :contact-info/home-phone
My best guess is that the edit to the :contact-info/home-phone field causes a re-render of ContactInfo component but not the parent Profile component, so the params on the onclick transact lambda don't get updated
but i'm still not sure what's the right way to do it
Yea, confirmed that switching to keyframe render-mode solves the problem. But if someone's got advice about a better way, I'd love to hear
from a first scan of the code the thing that stands out is that neither of them have initial-state
set
I had to add the following to a component to get the form state working:
;; in initial-state:
:answer-prompt (fs/add-form-config AnswerPrompt
(prim/get-initial-state AnswerPrompt))
interesting, looks promising. thanks, i'll give it a try