Closed martijnvdbrug closed 1 year ago
Hi Martijn,
It took me a while to get round to this, but I just added your tests to the existing entity-hydrator.e2e-spec.ts suite and it passed. So I'm suspecting that this somehow got fixed between 1.9.2 -> 2.0.5?
Have you run into this in the latest versions?
In any case, I'll leave the e2e tests in the suite to ensure this does not regress.
Thanks for looking into this. Unfortunately the issue still persists on my end. I've created a reproducable setup here: (It is using Vendure 2.0.5) https://github.com/Pinelab-studio/_temp_aug_2023_vendure_issue2013_repro
You can
git clone git@github.com:Pinelab-studio/_temp_aug_2023_vendure_issue2013_repro.git
yarn
yarn test
❯ testing.spec.ts (4) 5162ms
❯ Hydration issue (4) 5162ms
✓ Create order with 3 items 302ms
✓ Variant of orderLine 1 has a price
× Variant of orderLine 2 has a price
× Variant of orderLine 3 has a price
Thanks. This lead me to discover that I can reproduce the error when using postgres / sqlite - but it works with mysql, mariadb & sqljs! I'll look into how to fix...
Strange :disappointed: I remember last time we had an issue that was DB specific, it was caused by the order in which arrays were returned...
EDIT: nvm, I see it's already closed, nice!
Describe the bug When hydrating an active order with
applyProductVariantPrices=true
, only the variant of the first order line has pricing applied, the other will have price 0;To Reproduce Steps to reproduce the behavior: (see e2e test below)
order.lines[0].productVariant.price
will be 155880, whileorder.lines[1].productVariant.price
will be 0.Adding the variants in a different order will result in the same issue: it's always only the first variant that will have pricing applied.
Expected behavior I would expect all the variants to have the correct pricing.
Environment (please complete the following information):
Additional context You should be able to just copy and paste the test case below.
Products.csv:
hydration-error.spec.ts