Skip to content
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

Fix for deleting from ManyArray #3054

Merged
merged 1 commit into from
May 8, 2015
Merged

Conversation

wagenet
Copy link
Member

@wagenet wagenet commented May 8, 2015

Basically, if you delete the final object from a ManyArray elsewhere the following will happen:

  • The ManyArray will report the correct length of 0.
  • The ManyArray's objectAt(0) will still return a value.

The issue appears to be that the currentState is correctly empty, but the canonicalState still retains the deleted item. Because objectAt has a fallback, we incorrectly use the value from the canonicalState.

@wagenet wagenet force-pushed the fix-many-array-delete branch from adaf7d0 to 1333191 Compare May 8, 2015 21:51
expect(4);

env.adapter.deleteRecord = function() {
return { id: 1 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just return RSVP.resolve() as deletion doesn't usually return data

@wagenet wagenet force-pushed the fix-many-array-delete branch from 1333191 to 4b6750f Compare May 8, 2015 22:19
igorT added a commit that referenced this pull request May 8, 2015
@igorT igorT merged commit c6de18e into emberjs:master May 8, 2015
@wagenet wagenet deleted the fix-many-array-delete branch May 8, 2015 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants