scandipwa / performance
scandipwa/performance
N/A
ScandiPWA_Performance
Enhanced performance of product loading.
How to use
When adding a new resolved field to product interface, make sure to:
- Understand when you are able to load it? If you can load it on collection,
create a processor and register it inCompositeCollectionProcessorusing DI. - If data is needed to be formatted, or you can not request data with collection,
useDataPostProcessor. Register a processor there, and return a product (as key => value array)
processing function (see example in implementations). - If data is impossible to request before collection load, but it is possible to append
the loaded data afterwards (using the collection itself) - useCollectionPostProcessor, register
the processor there in the same way as forDataPostProcessor.
Related modules:
Initial motivation:
CASE ONE: The data can not be requested along with product collection
(only post-load is possible)
- After collection load, checked for requested fields in schema (using $info) for each additional info category
- If additional info was requested, the helper requested & returned the info for all products at once
- The loop through all loaded products applying data from helpers to each specific product
CASE TWO: The data can be requested before load
(field can be resolved with collection load)
This one is covered by M2 (by default) - we will just ignore this.
- The collection processor goes through collection, it adds requested fields to a collection
- If field requires additional work, it is formatted after collection load
- If field needs no formatting it is automatically out-putted in resulting data array
CASE THREE: The data can be requested after collection load,
but is based on the collection data, not product array.
Potential Issues
a. The code duplicates in each of 5 places were the collection was loaded [REQUIRES ABSTRACTION]
b. The data structures are common to be different from place to place, a check if field was requested or no is hard:
- ConfigurableVariant:
variants/product - Default:
products/items - Cart, Wish-list:
items/product - Orders:
order_products
What was implemented
GraphQL schema reading trait [new]
Class name: ScandiPWA\Performance\Model\Resolver\ResolveInfoFieldsTrait
Motivation: allows for GraphQL info parsing, can extract fields from path.
By default returns array of product fields, the product field parsing can be
changed by overriding getFieldContent method.
Used in:
ScandiPWA\Performance\Model\Resolver\Products\DataPostProcessor\ImagesScandiPWA\Performance\Model\Resolver\Products\DataPostProcessor\StocksScandiPWA\Performance\Model\Resolver\Products\DataPostProcessor\AttributesScandiPWA\CatalogGraphQl\Model\Resolver\ConfigurableVariantScandiPWA\CatalogGraphQl\Model\Resolver\Products\Query\FilterScandiPWA\WishlistGraphQl\Model\Resolver\WishlistItemsResolverScandiPWA\QuoteGraphQl\Model\Resolver\ProductsResolver
Collection post processor [new]
Class name: ScandiPWA\Performance\Model\Resolver\Products\CollectionPostProcessor
Motivation: allows to post-process collection, for situations, where data is
applied on-top of loaded collection - media gallery data, product options data, etc.
Used in:
ScandiPWA\CatalogGraphQl\Model\Resolver\Products\DataProvider\ProductScandiPWA\CatalogGraphQl\Model\Variant\Collection
Data post processor [new]
Class name: ScandiPWA\Performance\Model\Resolver\Products\DataPostProcessor
Motivation: allows for loaded product collection data post-processing. Accepts
array of products, resolve info and can efficiently process the product data.
Is made to prevent child fields of products to request the data in the loop.
Attribute, image, stock info is moved to this resolver out of product.
Used in:
ScandiPWA\WishlistGraphQl\Model\Resolver\WishlistItemsResolverScandiPWA\QuoteGraphQl\Model\Resolver\GetCartForCustomerScandiPWA\CatalogGraphQl\Model\Resolver\Products\Query\FilterScandiPWA\QuoteGraphQl\Model\Resolver\ProductsResolverScandiPWA\CatalogGraphQl\Model\Resolver\ConfigurableVariant
Product data provider [modified]
Class name: ScandiPWA\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product
Motivation: previously the collection post processor was implemented here (hard-coded).
Since it was moved into separate class, the logic had to be removed from origin.
Used in:
ScandiPWA\QuoteGraphQl\Model\Resolver\ProductsResolverScandiPWA\CatalogGraphQl\Model\Resolver\Products\Query\Filter
Products Collection processor [modified]
Class name: Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CompositeCollectionProcessor
Motivation: The M2 implementation was OK, just added additional processors to it:
ScandiPWA\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessor\ImagesProcessor
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 1.5.7 | stable | Fail | Magento 2.4.7 Details | 2022-11-23 07:38:08 |
| 1.5.6 | stable | Not tested | Not yet tested Details | 2022-06-09 19:20:08 |
| 1.5.5 | stable | Not tested | Not yet tested Details | 2021-12-30 14:39:18 |
| 1.5.4 | stable | Not tested | Not yet tested Details | 2021-12-29 02:17:36 |
| 1.5.3 | stable | Not tested | Not yet tested Details | 2021-12-09 21:21:01 |
| 1.5.2 | stable | Not tested | Not yet tested Details | 2021-10-26 18:03:23 |
| 1.5.1 | stable | Not tested | Not yet tested Details | 2021-09-28 19:53:41 |
| 1.5.0 | stable | Not tested | Not yet tested Details | 2021-09-21 10:34:03 |
| 1.4.6 | stable | Not tested | Not yet tested Details | 2021-07-01 11:45:31 |
| 1.4.5 | stable | Not tested | Not yet tested Details | 2021-06-28 12:54:36 |
| 1.4.4 | stable | Not tested | Not yet tested Details | 2021-06-16 14:05:49 |
| 1.4.3 | stable | Not tested | Not yet tested Details | 2021-03-04 14:58:38 |
| 1.4.2 | stable | Not tested | Not yet tested Details | 2020-12-28 12:27:35 |
| 1.4.1 | stable | Not tested | Not yet tested Details | 2020-12-21 15:26:11 |
| 1.4.0 | stable | Not tested | Not yet tested Details | 2020-11-25 14:10:58 |
| 1.3.0 | stable | Not tested | Not yet tested Details | 2020-11-05 09:28:53 |
| 1.2.0 | stable | Not tested | Not yet tested Details | 2020-09-07 11:06:06 |
| 1.1.0 | stable | Not tested | Not yet tested Details | 2020-08-24 14:14:04 |
| 1.0.4 | stable | Not tested | Not yet tested Details | 2020-06-09 14:54:35 |
| 1.0.3 | stable | Not tested | Not yet tested Details | 2020-05-05 06:19:55 |
| 1.0.2 | stable | Not tested | Not yet tested Details | 2020-03-06 11:54:41 |
| 1.0.1 | stable | Not tested | Not yet tested Details | 2020-01-07 10:08:27 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2020-01-06 15:14:58 |
Requires 9
| Package | Constraint |
|---|---|
| magento/framework | * |
| magento/module-catalog | * |
| magento/module-swatches | * |
| magento/module-store | * |
| magento/module-inventory-api | * |
| magento/module-eav | * |
| magento/module-inventory-catalog | * |
| magento/module-catalog-inventory | * |
| magento/module-catalog-graph-ql | ^100.3 |
No QA results yet
QA pipelines haven't run for this version. Compatibility and quality results appear here once the vendor publishes a tagged release that gets ingested.
More from scandipwa
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.