Skip to content

feat(vtex): real legacy productList loader + disambiguate picker labels#88

Open
guitavano wants to merge 1 commit into
mainfrom
feat/loader-title-jsdoc
Open

feat(vtex): real legacy productList loader + disambiguate picker labels#88
guitavano wants to merge 1 commit into
mainfrom
feat/loader-title-jsdoc

Conversation

@guitavano

@guitavano guitavano commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The Products picker showed three identical "ProductList" options because legacy/productList.ts and ProductList.ts were both just re-exports of intelligentSearch/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 loadervtex/loaders/legacy/productList.ts
Was export { default } from "../intelligentSearch/productList". Now a real implementation against the legacy Catalog Search API (/api/catalog_system/pub/products/search), ported from deco-cx/apps:

  • Selection by collection (productClusterIds), term (ft), fq, SKU ids, product ids; plus sort (legacy O) and count (_from/_to).
  • Lean toProductShelf() payload — same shape as the IS shelf loader, so both are interchangeable in ProductShelf sections.
  • Segment/regionalization handled by vtexCachedFetch.
  • Wired through a dedicated cachedProductListLegacy in commerceLoaders.ts (was pointing at the IS cached fn).
  • The deprecated, ctx-only similars enrichment from the deco-cx version is intentionally dropped (loaders here have no ctx; 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

  • Picker labels + hiding require decocms/deco-start#312 (@title/@ignore support in the schema generator). The legacy loader implementation works at runtime independently — the JSDoc tags are harmless no-ops on the current generator.
  • bunx tsc clean on all touched files (2 pre-existing unrelated recordCommerceMetric errors in instrumentedFetch.ts are on main already).
  • After both packages publish, sites bump them and re-run generate:schema to pick up the labels.

🤖 Generated with Claude Code


Summary by cubic

Adds a real VTEX legacy productList loader using the Catalog Search API and updates picker labels to show “Intelligent Search” vs “Legacy,” removing the duplicate option.

  • New Features

    • Implements vtex/loaders/legacy/productList.ts against /api/catalog_system/pub/products/search with collection/term/fq/SKU IDs/product IDs, plus sort (O) and count.
    • Returns the same lean shelf payload as the IS loader, so sections can swap either loader.
    • Adds cachedProductListLegacy in vtex/commerceLoaders.ts; routes legacy requests to this cache.
    • Sets @title on intelligentSearch/productList.ts (“Intelligent Search”) and legacy loader (“Legacy”).
    • Hides redundant alias vtex/loaders/ProductList.ts from the picker via @ignore while keeping it resolvable.
  • Migration

    • Picker labels and hiding require a schema generator with @title/@ignore support (update decocms/deco-start as needed), then run generate:schema. Runtime behavior works without this.

Written for commit 761fc09. Summary will update on new commits.

Review in cubic

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>
@guitavano guitavano requested a review from a team July 7, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant