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

Support "instant load" concept for addons that depend on the URL #157

Open
humitos opened this issue Sep 26, 2023 · 0 comments
Open

Support "instant load" concept for addons that depend on the URL #157

humitos opened this issue Sep 26, 2023 · 0 comments
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required

Comments

@humitos
Copy link
Member

humitos commented Sep 26, 2023

Material for MkDocs and other doctools (I think that Docusaurus too) implement a feature that load the content of the page without making a regular request to the server 1:

When instant loading is enabled, clicks on all internal links will be intercepted and dispatched via XHR without fully reloading the page.

This makes addons that depend on the actual URL to not work as expected (e.g. docdiff). When loading the page, the addons API is hit with url= but then the user clicks on an internal link, which uses the instant reload feature to load the page content but our addons doesn't do another request with the url= field updated, making docdiff to use the old URL to compare against.

I think we could listen to an event to check if the URL has changed and if so, make a request to the addons API again with the updated url= attribute. It seems there is a navigator API to do this, but it's experimental for now, tho: https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API

Footnotes

  1. https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#instant-loading

@humitos humitos added Improvement Minor improvement to code Needed: design decision A core team decision is required labels Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Projects
None yet
Development

No branches or pull requests

1 participant