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

Vendure can not find collection by slug if 2 collection have the same slug in different channels. #2395

Closed
ttournie opened this issue Sep 13, 2023 · 0 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@ttournie
Copy link
Contributor

Describe the bug
Vendure can not find collection by slug if 2 collection have the same slug in different channels.

To Reproduce
Steps to reproduce the behavior:

  1. Create a channel A
  2. Create a channel B
  3. in the channel A create a collection with slug 'test'
  4. in the channel B create a collection with slug 'test'
  5. try to get the channel by slug test in channel B (or A if channel B works). For this you can use the collection query

Expected behavior
It should return the right collection

Environment (please complete the following information):

  • @vendure/core version: 2.0.6
  • Nodejs version : 18.17
  • Database (mysql/postgres etc): postgres

Additional context

After investigation, it’s because the first query in CollectionService findOneBySlug, is not contextualised with the channel, but the last query is.
So it gets all the collection matching the criteria → if severals it take the first of the list, then try to get the collection by ID on the channel, but because the selected item in the first query is not from the right channel it does not finds it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants