fix(commerce-elastic-path): remove the product listing's dead sort (#502) - #508
Merged
Merged
Conversation
) Elastic Path's catalog product endpoints take no `sort` parameter. The Sorting guide lists the eight endpoints that accept one and no catalog endpoint is among them; an unsupported value is ignored rather than rejected, so a sorted request returned HTTP 200 in the store's unchanged order and nothing surfaced the problem. The values sent were not Elastic Path syntax either (`price asc`, `createdAt desc`) — `getSortVariables` was copied from another commerce provider, unused `isCategory` parameter included. Removes the Sort prop, `setSort`, the `sort` key on `productGridData`, the `sort` argument to `ep.getProductList`/`ep.getProductPage`, and the helper. Breaking: a project binding Sort or invoking `setSort` loses that binding, and the registered function arguments change, so the next publish-hostless cuts a new hostless version. For a sortable listing, EPCatalogSearchProvider with EPSearchSortBy sorts on the catalog search index.
The EP fork integrity test requires plasmicpkgs-dev to pin each EP package at its workspace version, and the version bump left this at 0.4.1.
`pnpm install --frozen-lockfile` rejects a manifest the lockfile does not match, so the 0.5.0 pin needs the lockfile specifier alongside it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #502.
The product listing had a Sort control that did nothing. Elastic Path's catalog
product endpoints take no
sortparameter — the Sorting guidelists the eight endpoints that accept one and no catalog endpoint is among them, and the
rendered API reference for
/catalog/productsand/catalog/nodes/{node_id}/relationships/productsdocuments only
include,filter,page[limit]andpage[offset]. An unsupported value isignored rather than rejected, so a sorted request returned HTTP 200 in the store's unchanged
order and nothing at runtime revealed that the control was dead.
The values being sent were not Elastic Path syntax either (
price asc,createdAt desc).getSortVariableswas copied from another commerce provider, unusedisCategoryparameterincluded; the same file still exists in the Shopify, Saleor, Swell and commercetools providers.
Since no mapping fix could work, this removes the control rather than repairing it:
initialSort) and thesetSortref action onEPProductListProvidersortkey onproductGridDatasortargument toep.getProductListandep.getProductPagesrc/utils/get-sort-variables.tssortwas the trailing parameter in both registered function specs, so no positionalargument shifts for Studio's generated calls.
For a sortable listing,
EPCatalogSearchProviderwithEPSearchSortBysorts on the catalogsearch index, which does support it. That separation is documented in COMPONENTS.md and
README.md alongside the reason the plain listing cannot.
Breaking
A project binding Sort or invoking
setSortloses that binding. The registered functionarguments change too, so the hostless
commerce-elastic-pathbundle needs republishing ordesigners keep seeing the old prop.
Opening an existing project in Studio shows a "Refresh code component props" modal listing
Removed: initialSort. It must be confirmed — until it is, the project bundle keeps orphanedStateParamreferences and programmatic writes fail with "Bundle invariant failed".Published as 0.5.0.