Open
Description
Preconditions and environment
- 2.4.7 (Should be in 2.4.8 as well)
- A grouped product exists with childCount >= 2 (Any number >=5; as a few more to make the N+1 queries more evident is recommended)
- A products GQL call which include the relevant field
- Should be close to this:
{ items { id sku ... on GroupedProduct { items { product { id sku } } } } }
- Should be close to this:
Steps to reproduce
- Create the grouped product as above
- Create a GQL query as above
- Enable query logging
- Send the GQL query
Expected result
- 1 query to load the grouped product children
- (Actually 2 or so; as per normal product collection/list loading)
Actual result
- N queries
Additional information
Issue appears to have been introduced here: ACPT-1181: reset mutable state after request - app/code/Magento/CatalogGraphQl/Model/Resolver/Product.php
-
You can observe the change from using the 'singleton' version to using the newly created version
-
Changing from the singleton version causes each call to this resolver to load only that one child
- Where, using the singleton, the deferred nature of the valueFactory with a callback meant that all, (subject to GQL resolution rules), would be set via addProductSku prior to the first one to trigger the callback
- Then the full list is loaded at once, and each subsequent valueFactory callback to resolve would use the previously loaded data.
-
(Also note, cursory review shows other uses of ProductDataProvider without using the Factory)
-
Going back to a singleton would resolve the performance issue
-
Converting to a 'BatchResolver' would allow the use of the factory and would enable mitigation of the performance issue
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Needs Update