Describe the bug
The entity hydrator does not hydrate reliably. The reason is that if the it finds an object early in the tree with the requested relation, it will stop. However, VERY often in Vendure the tree is full hydrated.
E.g. an orderLine > productVariant > product.
I created an order interceptor and for a cart with 2 items, the first items had the relationship, the second item didn't. I hydrate the object to have the product relation and I get an error when I access the variable bc it wasn't hydrated. This is SO frustrating.
It should not matter what happened before hydration. Hydration should simply ensure relations being loaded no matter what. This is likely an optimization related bug. The assumption being: "Oh, we have 1 productVariant.product relation", the rest will be there as well.
To Reproduce
Steps to reproduce the behavior:
- The easiest reproduction is writing a test with an incomplete object and hydrating it
Expected behavior
Hydration should guarantee relations being loaded
Actual behavior
It cannot be relied upon.
Environment (please complete the following information):
- @vendure/core version: 3.5.0
- Database (mysql/postgres etc): Postgres
- Operating System (Windows/macOS/Linux): Mac
- Package manager (npm/yarn/pnpm): yarn
Additional context
We have a heavily customized Vendure version with tons of plugins. That is likely a contributing factor, but it's not an excuse.
- When did this issue start occurring? It's been around since forever
- Does it happen consistently or intermittently? When it fails, it tends to fail always
- Any recent changes to your setup? No
Describe the bug
The entity hydrator does not hydrate reliably. The reason is that if the it finds an object early in the tree with the requested relation, it will stop. However, VERY often in Vendure the tree is full hydrated.
E.g. an orderLine > productVariant > product.
I created an order interceptor and for a cart with 2 items, the first items had the relationship, the second item didn't. I hydrate the object to have the product relation and I get an error when I access the variable bc it wasn't hydrated. This is SO frustrating.
It should not matter what happened before hydration. Hydration should simply ensure relations being loaded no matter what. This is likely an optimization related bug. The assumption being: "Oh, we have 1 productVariant.product relation", the rest will be there as well.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Hydration should guarantee relations being loaded
Actual behavior
It cannot be relied upon.
Environment (please complete the following information):
Additional context
We have a heavily customized Vendure version with tons of plugins. That is likely a contributing factor, but it's not an excuse.