fix(vtex): remove duplicate top-level fields from ProductList props#86
Merged
Merged
Conversation
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>
|
🎉 This PR is included in version 5.3.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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 ProductList loader form rendered duplicated inputs — two
Count, twoCollection, twoSort, twoHideUnavailableItems:The cause is
ProductListPropsdeclaring the same params twice: once inside thepropsunion (CollectionProps | QueryProps | ProductIDProps | FacetsProps) and again as flat top-level fields. The schema-driven admin form generates inputs for both, hence the doubles.Params should only be accepted inside
props.Scope
vtex/loaders/intelligentSearch/productList.ts(the__resolveTypefrom the reported config)vtex/loaders/productListFull.ts(identical duplicated interface)Why it's safe
props: {}shape; only 1 legacy block used flat top-level fields.resolveParamsreadsconst inner = props.props ?? propsand casts toany, so the lone flat block still resolves (its top-levelcollectionis still picked up byisCollectionProps). Only the generated schema/form changes.bunx tsc --noEmitpasses 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.query,count,sort,collection,hideUnavailableItemsfromProductListProps.resolveParamsstill supports the legacy flat shape viaprops.props ?? props.vtex/loaders/intelligentSearch/productList.ts,vtex/loaders/productListFull.ts.Written for commit 159c4a4. Summary will update on new commits.