Skip to content

Parent and Subfields #1161

Answered by radekmie
simplecommerce asked this question in Q&A
Aug 30, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Hi there! I guess we're talking about AutoForm here? If so, the logic we use for changing the model is here. Here's a quick test to see whether it handles this case or not:

setIn = (model, key, value) => _.setWith(_.clone(model), key, value, _.clone)
setIn({ address: null }, 'address.streetName', 'Elm') // { address: null }

No, it doesn't. I don't think it should either, as null is technically not a valid address, at least by my standards. Do you think it should handle this case? If so, where is this null coming from?

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@simplecommerce
Comment options

@simplecommerce
Comment options

@radekmie
Comment options

Answer selected by radekmie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants