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

Ordering of results #34

Open
dimoreira opened this issue Oct 10, 2016 · 7 comments
Open

Ordering of results #34

dimoreira opened this issue Oct 10, 2016 · 7 comments
Labels

Comments

@dimoreira
Copy link

When requesting an ordered endpoint of my API by some custom order field (like: updated_at DESC), my results gets reordered by id when parsed by the library.

There is some way to not reorder the results, just parse them in the order they appear in the API response?

@beauby
Copy link
Owner

beauby commented Oct 10, 2016

The primary data should remain in the same order. Are you referring to the included data?

@dimoreira
Copy link
Author

The primary data that is reordering basically because the simple way that browsers reshuffle object keys. Try this on Chrome console: {12: 'a', 2: 'b'}

This is the way my team solved the problem:
https://github.com/redvulps/jsonapi-datastore/commit/75bba57bd04e19b38be91f2a183b235093d08d2f

@beauby
Copy link
Owner

beauby commented Oct 10, 2016

That is some interesting information I was not aware of. Keeping the same order should be the default (and probably only) behavior IMO. Would you mind issuing a PR?

@dimoreira
Copy link
Author

@redvulps Could you send a PR to the main repo when you have time?

@beauby beauby added the bug label Oct 10, 2016
@redvulps
Copy link

hm, should we keep the current behavior as default? or return the same sorting as in the request as default?

@beauby
Copy link
Owner

beauby commented Oct 10, 2016

@redvulps I would favor returning the same sorting as in the request only. The current behavior is in fact undefined.

@ikristher
Copy link

I too experienced this problem. How can i solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants