refactor(samples): remove commerce location facet references - #8366
Conversation
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Tip All tests passed and all changes approved!🟢 UI Tests: 470 tests unchanged |
@coveo/atomic
@coveo/atomic-hosted-page
@coveo/atomic-legacy
@coveo/atomic-react
@coveo/auth
@coveo/bueno
@coveo/create-atomic
@coveo/create-atomic-component
@coveo/create-atomic-component-project
@coveo/create-atomic-result-component
@coveo/create-atomic-rollup-plugin
@coveo/create-ui
@coveo/headless
@coveo/headless-react
@coveo/relay
@coveo/shopify
commit: |
There was a problem hiding this comment.
Pull request overview
Removes the now-retired commerce location facet traces from the commerce sample apps, primarily by cleaning up breadcrumb rendering types and removing stale TODOs / mappings so samples are aligned ahead of the follow-up removal in @coveo/headless / @coveo/atomic.
Changes:
- Removes
LocationFacetValuereferences from commerce breadcrumb manager samples. - Deletes stale “add location facet support” TODO comments in facet generator samples.
- Removes the dead
locationentry from theFACET_CLASSmap in the commerce Express SSR sample.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/headless/commerce-react/src/components/breadcrumb-manager/breadcrumb-manager.tsx | Drops LocationFacetValue from breadcrumb value typing in the headless commerce React sample. |
| samples/headless-ssr/commerce-react-router/app/components/facets/facet-generator.tsx | Removes stale TODO about adding location facet support. |
| samples/headless-ssr/commerce-react-router/app/components/breadcrumb-manager.tsx | Drops LocationFacetValue from breadcrumb value typing in the React Router SSR sample. |
| samples/headless-ssr/commerce-nextjs/components/facets/facet-generator.tsx | Removes stale TODO about adding location facet support. |
| samples/headless-ssr/commerce-nextjs/components/breadcrumb-manager.tsx | Drops LocationFacetValue from breadcrumb value typing in the Next.js SSR sample. |
| samples/headless-ssr/commerce-nextjs-v4/components/facets/facet-generator.tsx | Removes stale TODO about adding location facet support. |
| samples/headless-ssr/commerce-nextjs-v4/components/breadcrumb-manager.tsx | Drops LocationFacetValue from breadcrumb value typing in the Next.js v4 SSR sample. |
| samples/headless-ssr/commerce-express/src/components/Facets.ts | Removes dead location → RegularFacet class mapping in the Express SSR sample. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
4beed99 to
8ad1f63
Compare
8ad1f63 to
3d99ed4
Compare
Location facets are being deprecated and were never adopted by any
customer. This removes every trace of them from the commerce samples,
ahead of removing the feature itself from @coveo/headless.
The four breadcrumb managers no longer name LocationFacetValue. Each now
declares the facet values it actually renders as a named type, and casts
at the call site:
type FacetBreadcrumbValue =
| CategoryFacetValue
| RegularFacetValue
| NumericFacetValue
| DateFacetValue;
The cast is required, not incidental. These components receive
Breadcrumb<AnyFacetValueResponse> from headless, and that union still
includes LocationFacetValue today. A consumer cannot narrow a type ahead
of the producer, so dropping the member from the parameter alone fails to
compile (TS2345). The cast keeps the sample honest about the four cases it
handles while accepting whatever headless emits. It stays valid after
location facets are removed, so the samples are no longer coupled to that
change.
Also removed:
- The stale COMHUB-291, COMHUB-292, and KIT-3808 "add location facet
support" TODOs.
- The dead location entry in the commerce-express FACET_CLASS map. It
mapped to 'RegularFacet', the map is typed Record<string, string>, and
the lookup already falls back to '?? RegularFacet', so behavior is
byte-identical.
No changeset: the samples are grouped as fixed with @coveo/headless and
@coveo/headless-react, so a changeset here would bump those published
packages for a samples-only change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3d99ed4 to
02a91ed
Compare
Context
Commerce location facets were added in Oct 2024 across five PRs: #4562 (core), #4569 (actions loader), #4571 (breadcrumbs + URL parameters), #4572 (user lat/long context), and #4574.
The feature shipped behind a platform feature flag and was opened up for a single customer when they migrated to the facet manager. That customer no longer uses it, no other customer adopted it, and the feature plus its flags are being retired.
This PR removes every trace of location facets from the samples. The removal from
@coveo/headlessand@coveo/atomicis tracked separately by CCRE-3966.What this changes
The four commerce breadcrumb managers. Each one previously inlined a five-member union in the parameter list, including
LocationFacetValue. Each now names the facet values it actually renders, and casts at the call site:Why the cast is required, not incidental. These components receive
Breadcrumb<AnyFacetValueResponse>from headless, and that union still includesLocationFacetValuetoday. A consumer cannot narrow a type ahead of the producer. An earlier revision of this PR dropped the member from the parameter without the cast, and the build failed:The
default:branch prevents a runtime problem, not a compile-time assignability error. Thanks to Copilot for catching that.The cast keeps each sample explicit about the four cases it handles, while accepting whatever headless emits. It remains valid after location facets are removed, so the samples are no longer coupled to that change — the follow-up PR touches no sample files at all.
Also removed:
COMHUB-291,COMHUB-292, andKIT-3808"add location facet support" TODOs.location: 'RegularFacet'entry from thecommerce-expressFACET_CLASSmap. It mapped to'RegularFacet', the map is typedRecord<string, string>, and the lookup already falls back to?? 'RegularFacet'— so behavior is byte-identical.There is no behavior change in any sample.
No changeset
Deliberate.
.changeset/config.jsongroups several of these samples asfixedwith@coveo/headlessand@coveo/headless-react, so a changeset here would bump those published packages for a samples-only change. The changeset for the breaking removal lives in the follow-up PR.Verification
tsc --noEmitclean of any breadcrumb or location error in all four affected samples:commerce-nextjs,commerce-nextjs-v4,commerce-react-router,commerce-react. Checked against headless as it stands onmain, i.e. withLocationFacetValuestill exported.oxlint,oxfmt, andcspellpass.locationFacet/location-facet, the location facet API symbols, bare'location'facet-type literals, thelf-*URL parameter,latitude/longitude/setLocation, and the TODO ticket refs. Zero remaining traces. The non-source tracked files (.svg,.example, ignore files) are clean too.🤖 Generated with Claude Code