Closed cherewaty closed 7 years ago
Feels like changeset
should be a computed property with data
and maybe validations
as a dependent key?
I'm curious to see how x-form/the initial data are getting created in your use case.
I'm not necessarily opposed to this idea (or @cowboyd's CP idea), but this strikes me as a surprising behavior so I'd like to get a little more context if possible.
If I understand from @cherewaty's description, when the value of the data
attribute changes, the changeset does not react. It only reacts on component initialization and also on successful submission.
I think that clearly it should do this, but why not have each click correspond to a route transition?
Replaced with https://github.com/thefrontside/emberx-form/pull/17
Problem
I have a two-column layout where selecting an item from the list in the left column opens an
x-form
to edit that item in the right column.If I click an item on the left, I successfully get a form with the right data from that model.
If I click a second (or third, fourth, etc.) item on the left, the
x-field
s within myx-form
don't update to reflect the new model passed in. They stick on the values of the original model selected.Proposed Solution
Use the
x-form
component'sdidUpdateAttrs()
hook. The hook will re-initialize the form's attached changeset any time one of the component's attributes (in this case,data
), changes.