Skip to content

refactor(samples): remove commerce location facet references - #8366

Merged
alexprudhomme merged 3 commits into
mainfrom
feat/remove-location-facets-samples
Aug 27, 2026
Merged

refactor(samples): remove commerce location facet references#8366
alexprudhomme merged 3 commits into
mainfrom
feat/remove-location-facets-samples

Conversation

@anthonydelage

@anthonydelage anthonydelage commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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/headless and @coveo/atomic is 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:

type FacetBreadcrumbValue =
  | CategoryFacetValue
  | RegularFacetValue
  | NumericFacetValue
  | DateFacetValue;

const renderBreadcrumbValue = (value: FacetBreadcrumbValue, type: string) => { ... };

// call site
renderBreadcrumbValue(value.value as FacetBreadcrumbValue, facetBreadcrumb.type)

Why 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. An earlier revision of this PR dropped the member from the parameter without the cast, and the build failed:

components/breadcrumb-manager.tsx(56,44): error TS2345:
  Argument of type 'AnyFacetValueResponse' is not assignable to parameter of type
  'RegularFacetValue | DateFacetValue | NumericFacetValue | CategoryFacetValue'.

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:

  • The stale COMHUB-291, COMHUB-292, and KIT-3808 "add location facet support" TODOs.
  • The dead location: 'RegularFacet' entry from 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.

There is no behavior change in any sample.

No changeset

Deliberate. .changeset/config.json groups several of these samples as fixed with @coveo/headless and @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 --noEmit clean 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 on main, i.e. with LocationFacetValue still exported.
  • oxlint, oxfmt, and cspell pass.
  • Swept 1073 source files across all 27 sample projects plus the templates and playgrounds, for locationFacet / location-facet, the location facet API symbols, bare 'location' facet-type literals, the lf-* 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

@anthonydelage
anthonydelage requested review from a team, alexprudhomme, louis-bompart and y-lakhdar and a lite review from Copilot August 26, 2026 18:52
@changeset-bot

changeset-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d629013

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svcsnykcoveo

svcsnykcoveo commented Aug 26, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@chromatic-com

chromatic-com Bot commented Aug 26, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 470 tests unchanged
🟢 UI Review: 470 stories published -- no changes
Storybook icon Storybook Publish: 470 stories published

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown
@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@8366

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@8366

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@8366

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@8366

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@8366

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@8366

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@8366

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@8366

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@8366

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@8366

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@8366

@coveo/create-ui

npm i https://pkg.pr.new/@coveo/create-ui@8366

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@8366

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@8366

@coveo/relay

npm i https://pkg.pr.new/@coveo/relay@8366

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@8366

commit: d629013

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LocationFacetValue references from commerce breadcrumb manager samples.
  • Deletes stale “add location facet support” TODO comments in facet generator samples.
  • Removes the dead location entry from the FACET_CLASS map 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 locationRegularFacet class mapping in the Express SSR sample.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread samples/headless-ssr/commerce-react-router/app/components/breadcrumb-manager.tsx Outdated
Comment thread samples/headless-ssr/commerce-nextjs/components/breadcrumb-manager.tsx Outdated
Comment thread samples/headless-ssr/commerce-nextjs-v4/components/breadcrumb-manager.tsx Outdated
@anthonydelage
anthonydelage force-pushed the feat/remove-location-facets-samples branch from 4beed99 to 8ad1f63 Compare August 26, 2026 19:27
@anthonydelage anthonydelage changed the title refactor(samples): remove commerce location facet references refactor(samples): remove stale commerce location facet TODOs Aug 26, 2026
@anthonydelage
anthonydelage force-pushed the feat/remove-location-facets-samples branch from 8ad1f63 to 3d99ed4 Compare August 26, 2026 19:54
@anthonydelage anthonydelage changed the title refactor(samples): remove stale commerce location facet TODOs refactor(samples): remove commerce location facet references Aug 26, 2026
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@alexprudhomme
alexprudhomme added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit d14a8c0 Aug 27, 2026
49 checks passed
@alexprudhomme
alexprudhomme deleted the feat/remove-location-facets-samples branch August 27, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants