We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
orderBy
Using orderBy constraint on nested relations does not fulfil the order criteria.
This seems to be affecting the following relationships:
static fields() { return { id: this.attr(null), roles: this.belongsToMany(Role, RoleUser, 'user_id', 'role_id') } }
User.create({ data: { id: 1, roles: [ { id: 1 }, { id: 3 }, { id: 2 } ] } })
const user = User.query().with('roles', (query) => { query.orderBy('id') }).find(1)
The user roles should be in ascending order by id.
id
{ id: 1, roles: [ { id: 1 }, // Role { id: 2 }, // Role { id: 3 } // Role ] } // User
The order is actually symmetrical to the order the records, pivots et all, are created.
{ id: 1, roles: [ { id: 1 }, // Role { id: 3 }, // Role { id: 2 } // Role ] } // User
An example of a Many To Many implementation can be found here.
The text was updated successfully, but these errors were encountered:
fix: resolve orderBy constraints on many-to-many relations
06bacfc
Related to issue vuex-orm#571
Thanks for finding this out! Is the fix ready...?
Sorry, something went wrong.
The commit resolves all but has-through. I still need to look into this one.
Oh OK. Great. Thank you for working on it! 🤝
cuebit
Successfully merging a pull request may close this issue.
Description
Using
orderBy
constraint on nested relations does not fulfil the order criteria.This seems to be affecting the following relationships:
Steps to reproduce
Expected behaviour
The user roles should be in ascending order by
id
.The order is actually symmetrical to the order the records, pivots et all, are created.
Demo
An example of a Many To Many implementation can be found here.
Versions
orderBy
feat was introduced.The text was updated successfully, but these errors were encountered: