Skip to content

Fix for deleting from ManyArray - #3054

Merged
igorT merged 1 commit into
warp-drive-data:masterfrom
wagenet:fix-many-array-delete
May 8, 2015
Merged

Fix for deleting from ManyArray#3054
igorT merged 1 commit into
warp-drive-data:masterfrom
wagenet:fix-many-array-delete

Conversation

@wagenet

@wagenet wagenet commented May 8, 2015

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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 warp-drive-data: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