Closed Betanoir closed 4 days ago
hey @Betanoir, ordering by default is not guaranteed, you can use order
query param if you want to rely on consistent ordering.
E.g. /products/<product_id>/variants?limit=10&offset=0&order=created_at
@fPolic Okay, thank you Just one thing that was strange was that this changed after the release of v2.0.3 yesterday so that's why I created an issue. I guess it's better practice to use the order by though, thanks 🙃
Package.json file
Node.js version
v21.7.3
Database and its version
PostgreSQL 13
Operating system name and version
Windows 11
Browser name
Chrome
What happended?
API route for
update variant
returns a different order of variants than what is returned from theget product
route.Expected behavior
When fetching from the
get product
route, the variants attribute should contain the same order as the returned product when you request theupdate variant
route under the sameproduct.id
, considering it comes from the database.Actual behavior
This is what is returned when loading the product page:
Below is the variants attribute of the product that is returned when I update the variant using the SDK. This same set and order of variants is returned when I make a request to the get product route after updating the variant (separate to the returned product)
The titles are in a different order
Link to reproduction repo
N/A