Nested dirtyness
See original GitHub issueI didn’t see any example of keeping track of nested levels of “dirtyness”, so I assume this feature either isn’t implemented or the user is supposed to use another approach for it.
Example: If I update a project’s name
, and projects
is a hasMany relationship on user
, I’d like user.get('isDirty')
to return true.
Is this possible? How would you recommend tackling this problem?
The immediate solution that comes to mind would be
// models/user.js
// ...
isDeepDirty: computed('projects.@each.isDirty', function() {
return this.get('projects').any((p) => p.get('isDirty'));
})
And you would probably need to call startTrack()
on all projects?
This also creates a separate computed property. Just wondering if anyone has an alternative approach they could share.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Dirty prop not changing when deeply nested field is changed
So, lets say I have this: <Formik initialValues={{ items: [{ name: "Stick" }] }} ... I then do this: formikProps.values.items[0].name ...
Read more >check if (child) form is dirty in nested reactive forms
You can access the group dirtiness by calling formGroup.get('one').dirty. That returns the FormGroup as AbstractControl , thus with standard ...
Read more >Nested Sleep- How to solve your child's nighttime and nap ...
Learn about your body's circadian rhythms including the stomach and gut, the importance of getting your child on an eating schedule, and how ......
Read more >rails Dirty object concept is not working with nested att
I want to use dirty object with nested attributes here is my example. i have form having user and addresses field when i...
Read more >attribute_will_change! (ActiveModel::Dirty) - APIdock
Use this for validatating nested forms. When you create a nested form, and want the main object to validate all nested models, you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok … good to know @alexander-alvarez … I think I can get to this in a few weeks ( be more free then ), but would want to discuss it with someone, work on it together perhaps ?, let me know if you interested
Dropping in to say this I would find use for this too 👍 For the time being I did a simple concat of the current models
isDirty
and that of the relationships.I have top level models for which I “deep save”, so the “deep is dirty” is nice corollary