-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snapshot changes is wrong when object has proxy attributes #102
Comments
@urbany Thx for the issue! Do you have an example test we could add here? It would be good to know how you get to this state! |
We also see this inconsistency. The fastest way to get there is to start with a POJO model that has a sub-key with an attribute set and then create a changeset off of it. Then call ... you can also hit it quickly by simply having a change on a subkey, then snapshotting and restoring the changeset - that should effectively be a no-op, but actually it clears out the changes on all the nested paths. |
...I should add that we just upgraded to v3 from v2 of ember-changeset and hit this there as v3 picks up this version. This has had some catastrophic consequences as we did not initially discover it (our bad) in our testing and now we can't go back due to other dependencies. This is not an obvious condition to detect - it comes out as odd behaviour in user-side support complaints. I say all of this because once resolved, you may wish to mark the tags with this issue as deprecated to help others move past it. |
If someone has a failing test they would like to contribute that would be phenomenal! I can continue the work if that is something you didn't want to take on. |
Just run this - I would expect by contract of the changeset that the console entries would match.
|
Hi, changeset of ED Models with async belongsTo relationships show incorrect changes on snapshot:
change
andchanges
are correct, butsnapshot().changes
shows all my async belongsTo as changed attributes incorrectly.I think this is because of this unrwrap https://github.com/validated-changeset/validated-changeset/blob/da68651a41028ab827872cf10960920779c2a09f/src/index.ts#L975
Which adds all the unwrapped relationships to
this[CHANGES]
. When i getchange
andchanges
these incorrect changes are filtered out, but not on snapshot.Does my explanation make sense? Thanks in advance!
EDIT:
If anyone else comes here looking for a solution I'm currently creating snapshots like this until it is fixed
The text was updated successfully, but these errors were encountered: