-
Notifications
You must be signed in to change notification settings - Fork 109
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
Preserve order of collection when updating an object. #74
Conversation
This PR aims to preserve the ordering of a collection when making an update and references this issue. Currently, after making an update this what the response will come back as. const state = [ { type: 'users',
id: '1',
attributes: { name: 'John Doe' },
relationships: { companies: [Object] } },
{ type: 'users',
id: '2',
attributes: { name: 'Emily Jane' },
relationships: { companies: [Object] } } ];
const updatedState = [ { type: 'users',
id: '2',
attributes: { name: 'Emily Jane' },
relationships: { companies: [Object] } },
{ type: 'users',
id: '1',
attributes: { name: 'Sir John Doe' },
relationships: { tasks: [Object] } } ]; With the preservation of order here is what we get. const state = [ { type: 'users',
id: '1',
attributes: { name: 'John Doe' },
relationships: { companies: [Object] } },
{ type: 'users',
id: '2',
attributes: { name: 'Emily Jane' },
relationships: { companies: [Object] } } ]
const updatedState = [ { type: 'users',
id: '1',
attributes: { name: 'Sir John Doe' },
relationships: { tasks: [Object] } },
{ type: 'users',
id: '2',
attributes: { name: 'Emily Jane' },
relationships: { companies: [Object] } } ] |
Would've loved to see the test in a commit before the fix, then it's easier to review that it's failing without your fix :) |
@egeriis Can you clarify your strategy here? Do you want me to submit a failing test, you look at it, then I fix it or just create a new test and merge? |
@Petesta No action needed for this. But if you are making two separate commits, first one is a failing test the next one is the fix. That should prompt GitHub to display that the first commit has a failing test and that the next one resolves this :) |
We will merge and publish today :) |
Published to npm |
No description provided.