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
Offline plugin: large sites freeze on initial load due to initializing search #4212
Comments
Thanks for reporting and the detailed analysis. When serving via |
Thanks for the reply. As expected, it was a limitation of browsers. I am considering making changes to the plugin code for our project. Could you please let me know if you know where and how to change the code I should modify to defer search index initialization to the moment when the user clicks the search bar? |
Fixed in squidfunk/mkdocs-material-insiders@3724e19d5. Now, if the protocol is It's actually close to a miracle we could make search work on local browsing in the first place 😉 |
Released as part of 8.4.0+insiders-4.21.1. |
Contribution guidelines
I've found a bug and checked that ...
mkdocs
orreadthedocs
themescustom_dir
,extra_javascript
andextra_css
Description
I want to use more than 1000 files offline in our project. This search_index file size is more than 10MB.
When opening the offline documents with the file://schema, the main thread is blocked by the search plugin, and I have to wait.
Probably a browser implementation issue, not a problem with Mkdocs for Materials itself.
Is there a workaround for this problem or any way to delay the search initialization, such as focusing on the search windows and then initializing it?
Consideration
The Material for Mkdocs search plugin is implemented as a Web Worker and works fine online. But offline, Chrome and Firefox cannot start the Web Worker with the file://, so every time a page is opened, the initialization of the search function blocks the main thread.
This block makes the navigation operation delayed.
Performance of a small number of files(offline)
Performance of a large number of files(offline)
Performance of a large number of files(offline) that hosted on an http server
Chrome
Firefox
From this performance, it appears that,
I am not sure, but due to a combination of browser implementations, is WebWorker not working as intended in the case of file://?
Expected behaviour
The navigation can be opened offline with file:// as well as with http:// without delay.
Actual behaviour
The navigation is delayed when offline with file://.
Steps to reproduce
Package versions
Configuration
System information
The text was updated successfully, but these errors were encountered: