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

Added loading of sitemap to filter instant loading requests #1668

Merged
merged 1 commit into from May 9, 2020

Conversation

squidfunk
Copy link
Owner

This PR is a fix attempt for #1653. When instant loading is enabled, the current master will intercept all links that are relative to the base_url and assume that they can be loaded via XHR. However, as described in the linked issue, static pages may be included as part of the build, but not part of the documentation as such. For this reason, we need a way to distinguish URLs to be loaded via instant loading.

With this PR, before setting up instant loading, the sitemap.xml is fetched, which is built by MkDocs and includes all URLs to all documents that are part of the navigation tree. Before dispatching via XHR, the application now checks whether the URL is part of this list. If it is part of the list, the request is loaded via XHR, if it isn't, it is dispatched regularly.

As this is a pretty fundamental change, I'd want to get some feedback before merging this into master. Also, locally, the URL must now match the development server host, or instant loading won't work, e.g. when the docs are served with -a 0.0.0.0, URLs including localhost won't be dispatched. If somebody has a good idea of how to get a canonical URL out of all the different localhost stuff, I'd be happy to integrate it.

@netlify
Copy link

netlify bot commented May 3, 2020

Deploy preview for mkdocs-material-preview ready!

Built with commit 6a9495b

https://deploy-preview-1668--mkdocs-material-preview.netlify.app

@squidfunk
Copy link
Owner Author

As I received no feedback, we just release it and fix bugs as we go.

@squidfunk squidfunk merged commit 252db13 into master May 9, 2020
@sdague
Copy link

sdague commented May 11, 2020

Something about this change has made it so that instant mode with our site goes completely unresponsive. I downgraded to 5.1.5 and it works again.

It's so unresponsive that pulling up firefox dev tools doesn't even work, and the browser asks if I want to Wait or Stop the script that's taking the page too long to load.

@squidfunk
Copy link
Owner Author

Thanks for reporting. Could you open an issue for that including the necessary details? In the meantime you can disable instant loading and everything should be back to normal.

@squidfunk squidfunk deleted the fix/limit-instant-loading-to-docs branch May 11, 2020 12:52
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.

None yet

2 participants