-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
perf(v2): algolia search result no longer cause full page refresh #2079
Conversation
Deploy preview for docusaurus-2 ready! Built with commit ea54588 |
Deploy preview for docusaurus-preview ready! Built with commit ea54588 |
// Algolia use closest parent element id #__docusaurus when a h1 page title does not have an id | ||
// So, we can safely remove it. See https://github.com/facebook/docusaurus/issues/1828 for more details. | ||
const routePath = | ||
`#__docusaurus` === a.hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt want to do replace() because thats not supported in older browser and will have to be polyfilled :v
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool! Is there a handleHover
? Then we can preload when they are hovering LOL. I'm not very used to seeing the bar at the top now.
cc @s-pace for docsearch full api. |
Not easily available in the v2, we will make sure to have it available from the v3. |
@s-pace thanks. By the way what time do DocSearch usually crawl ? So next time I can cut the new version docs just right before it starts to crawl |
@endiliey there is no guarantee on the exact time. We can disable the crawl if you want so that it does not broke your search experience during your development. |
@s-pace thank you for the info. The reason why I asked is because usually when I cut a new version of docs for Docusaurus, so there will be a downtime of ~1 day for the search (until it crawl). But i guess its ok :) |
Motivation
Use client side navigation, avoid full page refresh on algolia search result. The extra benefit is also pretty rad, local dev can work nicely now. Previously it will always go to v2.docusaurus.io/xxxx
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
Before
Try https://v2.docusaurus.io/ and search anything. It will cause page refresh
After
Also still in localhost