feat(theme-search-algolia): use DocSearch v4.1, optimize integration#11421
Merged
feat(theme-search-algolia): use DocSearch v4.1, optimize integration#11421
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: -419 kB (-3.47%) Total Size: 11.6 MB
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: -430 kB (-3.44%) Total Size: 12.1 MB
ℹ️ View Unchanged
|
…slorber/use-docsearch-4.1
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
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.
Motivation
This follows up on the Algolia DocSearch v4 integration started here: #11327 (review)
v4.1 is still heavy (see algolia/docsearch#2769), but it exposes multiple entrypoints that will code-split better. The main bundle only includes the DocSearch button code, and the rest of the code is code-split and lazy-loaded when the user is about to interact with the Algolia DocSearch button.
We have ensured that the integration remains compatible with DocSearch ^v3.9 for those willing to stay on the former version.
Bundle size
From what we see, this new v4.1 integration improves code splitting compared to v4.0 but also v3.9. Despite the modal becoming heavier, it's now properly code-split and lazy-loaded (like we thought it was in v3.9).
This means that upgrading from v3.9 to v4.1, you should see your main bundle size decrease significantly. However, when you are about to load the modal (button hover), the bundle to load will be heavier (even if you don't use the new Ask AI feature, unfortunately, but the Algolia team plans to solve that later).
See my comment with the impact on the main JS bundle sizes here: algolia/docsearch#2769 (comment)
DocSearch v3.9: https://68cd2c5d1ca4700009008f2e--docusaurus-2.netlify.app/
DocSearch v4.1: https://68d54d82bf81160008c7de97--docusaurus-2.netlify.app/
Test Plan
CI bundle size stats + deploy preview
Test links
https://deploy-preview-11421--docusaurus-2.netlify.app/