feat(vtex): real legacy productList loader + disambiguate picker labels#88
Open
guitavano wants to merge 1 commit into
Open
feat(vtex): real legacy productList loader + disambiguate picker labels#88guitavano wants to merge 1 commit into
guitavano wants to merge 1 commit into
Conversation
vtex/loaders/legacy/productList.ts was a re-export of the Intelligent Search loader, so the admin offered two identical "Product List" options (plus a third redundant path alias). Now: - legacy/productList.ts: real implementation against the legacy Catalog Search API (/api/catalog_system/pub/products/search), ported from deco-cx/apps. Selection by collection / term / fq / SKU ids / product ids, with sort and count. Lean toProductShelf() payload for parity with the IS shelf loader. (The deprecated ctx-only `similars` enrichment is dropped.) Wired via a dedicated cached loader in commerceLoaders. - @title tags so the picker shows "Intelligent Search" and "Legacy". - ProductList.ts (0 usages across sites): @ignore to hide the redundant alias from the picker; kept resolvable for any pre-existing blocks. Picker labels require @decocms/start with @title/@ignore support. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
The Products picker showed three identical "ProductList" options because
legacy/productList.tsandProductList.tswere both just re-exports ofintelligentSearch/productList.ts. VTEX actually provides two product-list backends — Intelligent Search and the legacy Catalog Search — so this makes them two real, distinct options and drops the redundant third.Changes
1. Real legacy loader —
vtex/loaders/legacy/productList.tsWas
export { default } from "../intelligentSearch/productList". Now a real implementation against the legacy Catalog Search API (/api/catalog_system/pub/products/search), ported fromdeco-cx/apps:productClusterIds), term (ft), fq, SKU ids, product ids; plussort(legacyO) andcount(_from/_to).toProductShelf()payload — same shape as the IS shelf loader, so both are interchangeable in ProductShelf sections.vtexCachedFetch.cachedProductListLegacyincommerceLoaders.ts(was pointing at the IS cached fn).ctx-onlysimilarsenrichment from the deco-cx version is intentionally dropped (loaders here have noctx; deco-cx already steers callers to product extensions).2. Picker labels (
@title)intelligentSearch/productList.ts→ "Intelligent Search"legacy/productList.ts→ "Legacy"3. Hide redundant alias (
@ignore)vtex/loaders/ProductList.ts(0 usages across casaevideo / bagaggio / lebiscuit) → hidden from the picker, kept resolvable so any pre-existing block still works.Notes
@title/@ignoresupport in the schema generator). The legacy loader implementation works at runtime independently — the JSDoc tags are harmless no-ops on the current generator.bunx tscclean on all touched files (2 pre-existing unrelatedrecordCommerceMetricerrors ininstrumentedFetch.tsare onmainalready).generate:schemato pick up the labels.🤖 Generated with Claude Code
Summary by cubic
Adds a real VTEX legacy
productListloader using the Catalog Search API and updates picker labels to show “Intelligent Search” vs “Legacy,” removing the duplicate option.New Features
vtex/loaders/legacy/productList.tsagainst/api/catalog_system/pub/products/searchwith collection/term/fq/SKU IDs/product IDs, plussort(O) andcount.cachedProductListLegacyinvtex/commerceLoaders.ts; routes legacy requests to this cache.@titleonintelligentSearch/productList.ts(“Intelligent Search”) and legacy loader (“Legacy”).vtex/loaders/ProductList.tsfrom the picker via@ignorewhile keeping it resolvable.Migration
@title/@ignoresupport (updatedecocms/deco-startas needed), then rungenerate:schema. Runtime behavior works without this.Written for commit 761fc09. Summary will update on new commits.