question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I 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:open
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
danielspanielcommented, Nov 10, 2017

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

1reaction
alexander-alvarezcommented, Nov 9, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found