-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
A 'deleteObject' from a hasMany relation with an object not included in the collection, deletes another object within the collection #8318
Labels
Comments
Probably the shim to deprecate removeObject allows negative indexes as native splice allows negative. Should be an easy guard to add here:
|
@jrjohnson this could be an easy one for you <3 |
Is this issue currently being worked on by anyone? If not, I'd like to work on it! |
Go for it @rossketron! |
rossketron
added a commit
to rossketron/ember-data
that referenced
this issue
Nov 28, 2022
runspired
pushed a commit
to rossketron/ember-data
that referenced
this issue
Dec 7, 2022
runspired
added a commit
that referenced
this issue
Dec 7, 2022
…8323) * fix: Only remove from record array if in collection #8318 * test: Update tests to use hasMany relationship and add deprecatedTests * chore: Seperate tests for sync/async * update tests post-review Co-authored-by: Chris Thoburn <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproduction
Following straight forward qunit test can be copied to quickly reproduce the issue:
Description
One expects that an attempt to delete an object from a hasMany relationship that is not included in the collection, should have no effect. Instead some other object from the collection seems to be deleted (see last failing assert: the resulting collection only contains one element anymore instead of the original two elements).
I tested this with an AsyncHasMany relation (async=true), but it also fails when the relation is defined as synchronous (async=false).
Versions
This scenario did work in ember-data 4.4.0 but not anymore with 4.8.3.
Tests were done with:
The text was updated successfully, but these errors were encountered: