Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(headless commerce SSR): refactor remix sample to include search box in global header #5065

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fbeaudoincoveo
Copy link
Contributor

@fbeaudoincoveo fbeaudoincoveo commented Mar 12, 2025

https://coveord.atlassian.net/browse/KIT-4048

In summary:

I added a Header component, which accepts children.

In the root Layout, we now check whether we're on the search page (by looking at the URL pathname). If we're NOT on the search page, we pass a StandaloneSearchBox component wrapped in a StandaloneProvider as a child to the Header.

If we're on the search page, we instead pass a SearchBox component as a child for the Header, and we wrap the ParameterManager and Header components, as well as all children in a SearchProvider. This means we can remove all of the logic from the Search page loader (and also remove the Search page's wrapping SearchProvider).

The fact that we're now doing more Headless-related logic in the root Layout made me realize that we could do some refactoring to simplify a few things.

Instead of always setting the navigator context provider and updating the search token, I wrote a util to get the pre-updated definition.

I also wrote another util to get the base fetch static state configuration (because it's always basically the same).

@fbeaudoincoveo fbeaudoincoveo requested a review from a team as a code owner March 12, 2025 20:50
@fbeaudoincoveo fbeaudoincoveo changed the title doc(headless commerce SSR): refactor Remix sample to use global header doc(headless commerce SSR): refactor remix sample to include search box in global header Mar 12, 2025
Copy link

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:
<type>(optional scope): <description>

Example: feat(headless): add result-list controller

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 246.6 246.6 0
commerce 359.2 359.2 0
search 417.3 417.3 0
insight 408.5 408.5 0
recommendation 258 258 0
ssr 411.1 411.1 0
ssr-commerce 375.7 375.7 0

@fbeaudoincoveo fbeaudoincoveo added this pull request to the merge queue Mar 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 19, 2025
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.

2 participants