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

Improve predictive search performance #1823

Merged
merged 5 commits into from
Mar 12, 2024
Merged

Improve predictive search performance #1823

merged 5 commits into from
Mar 12, 2024

Conversation

frandiox
Copy link
Contributor

@frandiox frandiox commented Mar 7, 2024

The predictive search API and components were making 3 requests for every key stroke: the actual API request + root revalidation + route revalidation:

image

I'm changing the Form method to GET here, which avoids unnecessary Remix revalidations. Plus, it gives us the opportunity to set Cache-Control headers in the response, which is useful when typing:

image

Typing something new goes through, but typing the same thing just uses the browser cache for up to a minute.

We could also consider debouncing but it's probably OK with this?

@frandiox frandiox requested a review from a team March 7, 2024 01:52
Copy link
Contributor

shopify bot commented Mar 7, 2024

Oxygen deployed a preview of your fd-search-performance branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:56 AM
subscriptions ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:56 AM
skeleton ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:56 AM
optimistic-cart-ui ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:56 AM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:57 AM
vite ✅ Successful (Logs) Preview deployment Inspect deployment March 7, 2024 3:57 AM

Learn more about Hydrogen's GitHub integration.

Copy link
Contributor

@wizardlyhel wizardlyhel left a comment

Choose a reason for hiding this comment

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

With the browser cache control header, I don't think we need to debounce the request

@frandiox frandiox merged commit c136030 into main Mar 12, 2024
12 checks passed
@frandiox frandiox deleted the fd-search-performance branch March 12, 2024 03:40
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.

3 participants