Skip to content

fix(vtex): remove duplicate top-level fields from ProductList props#86

Merged
guitavano merged 1 commit into
mainfrom
fix/productlist-props-duplicate-fields
Jul 6, 2026
Merged

fix(vtex): remove duplicate top-level fields from ProductList props#86
guitavano merged 1 commit into
mainfrom
fix/productlist-props-duplicate-fields

Conversation

@guitavano

@guitavano guitavano commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The ProductList loader form rendered duplicated inputs — two Count, two Collection, two Sort, two HideUnavailableItems:

duplicated props

The cause is ProductListProps declaring the same params twice: once inside the props union (CollectionProps | QueryProps | ProductIDProps | FacetsProps) and again as flat top-level fields. The schema-driven admin form generates inputs for both, hence the doubles.

// before
export interface ProductListProps {
  props?: CollectionProps | QueryProps | ProductIDProps | FacetsProps;
  query?: string;          // ← flat duplicates
  count?: number;
  sort?: string;
  collection?: string;
  hideUnavailableItems?: boolean;
}

// after
export interface ProductListProps {
  props?: CollectionProps | QueryProps | ProductIDProps | FacetsProps;
}

Params should only be accepted inside props.

Scope

  • vtex/loaders/intelligentSearch/productList.ts (the __resolveType from the reported config)
  • vtex/loaders/productListFull.ts (identical duplicated interface)

Why it's safe

  • Surveyed the configured blocks: 578 of 579 use the nested props: {} shape; only 1 legacy block used flat top-level fields.
  • Runtime is unaffected — resolveParams reads const inner = props.props ?? props and casts to any, so the lone flat block still resolves (its top-level collection is still picked up by isCollectionProps). Only the generated schema/form changes.
  • bunx tsc --noEmit passes with no new errors.

Testing notes

Republish the app and reopen the ProductList loader form — the duplicated Count/Collection/Sort/HideUnavailableItems inputs are gone; params are configured only under props.

🤖 Generated with Claude Code


Summary by cubic

Removed duplicate top-level fields from ProductList props to stop duplicated inputs in the admin form. Params now live only under props; runtime behavior stays the same.

  • Bug Fixes
    • Removed top-level query, count, sort, collection, hideUnavailableItems from ProductListProps.
    • Fixes duplicated Count/Collection/Sort/HideUnavailableItems inputs in the ProductList loader form.
    • Safe change: resolveParams still supports the legacy flat shape via props.props ?? props.
    • Touched files: vtex/loaders/intelligentSearch/productList.ts, vtex/loaders/productListFull.ts.

Written for commit 159c4a4. Summary will update on new commits.

Review in cubic

ProductListProps declared its params twice: once inside the `props`
union and again as flat top-level fields (query/count/sort/collection/
hideUnavailableItems). The schema-driven admin form rendered both sets,
showing duplicated Count/Collection/Sort/HideUnavailableItems inputs.

Keep only the `props` union — the dominant and intended shape (578 of
579 configured blocks use nested `props: {}`). Runtime is unaffected:
resolveParams reads `props.props ?? props` and casts to any, so the
lone legacy flat block still resolves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@guitavano guitavano requested a review from a team July 6, 2026 20:10
@guitavano guitavano merged commit e7782f5 into main Jul 6, 2026
2 checks passed
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 5.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant