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

Instant loading: browser back button breaks internal links #6345

Closed
4 tasks done
thesuperzapper opened this issue Nov 16, 2023 · 12 comments
Closed
4 tasks done

Instant loading: browser back button breaks internal links #6345

thesuperzapper opened this issue Nov 16, 2023 · 12 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@thesuperzapper
Copy link

Context

No response

Bug description

On all browsers, if you have instant loading enabled, and click on an internal link, then use the browser's back button, attempting to use the same link again will do nothing.

Related links

Reproduction

9.4.8-back-button-breaks-links.zip

Steps to reproduce

  1. Run any site with instant loading
  2. Click on an internal link
  3. Use browser's back button
  4. Try click the same internal link again
  5. Notice that clicking the link does nothing

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. We'll fix this once we find the time to work on instant loading again.

@squidfunk squidfunk added the bug Issue reports a bug label Nov 17, 2023
@squidfunk squidfunk changed the title browser back button breaks internal links with instant loading Instant loading: browser back button breaks internal links Nov 17, 2023
@thesuperzapper
Copy link
Author

@squidfunk I appreciate it, I really like the instant loading feature because it prevents the jiggling on every page navigation that you get if you turn it off (which I find distracting).

@squidfunk
Copy link
Owner

I'm glad you like it! My time is currently bound with other parts of the theme + community support. I really hope for more sponsors to support the project, so I can delegate more of the community work to other folks, fixing bugs and churning out new features faster ☺️ But you know how it is, most users think Open Source is free, whereas it's always someone else's time.

@thesuperzapper
Copy link
Author

@squidfunk I am intimately aware, and very grateful for your time, and I hope to sponsor once my project (deployKF) starts making money!

@thesuperzapper
Copy link
Author

@squidfunk I have tracked down the cause of this issue, the issue no longer appears when I remove the following line:

// Hack: we need to make sure that we don't end up with multiple history
// entries for the same anchor link, so we just remove the last entry
history.back()

I think it's worth just removing this line and dealing with the fact that crazy users can add hundreds of history elements if they spam-click stuff.

But there is probably also some other fix that only prevents repeated anchor clicks and not actual page/path moves.

@squidfunk
Copy link
Owner

Thanks for investigating. We want to solve this thoroughly, so just removing this line is not that simple. We added this line for reason. We need to refactor the logic, and I need to set aside time for that. Will come back to this in the next months.

@thesuperzapper
Copy link
Author

Any chance we can get some kind of flag in the mean time, to avoid me having to make a local fork?

@squidfunk
Copy link
Owner

Nope, sorry. The introduction of additional feature flags needs to be done very carefully. You know, this project is used by tens of thousands of projects, including thousands of companies. We need to keep it stable. In the meantime, please disable instant loading to mitigate the problem. We'll work on that very soon again. We also hope for more funding from companies, which will allow us to fix problems and push out new features faster. In the meantime, we need to budget our, and especially my, time. I'm sorry for the inconvenience this is causing you or your company, but you know how it is.

@thesuperzapper
Copy link
Author

I totally understand thanks for all your hard work! I have made a temporary fork with that line removed so Instant navigation works properly on my site.

@squidfunk
Copy link
Owner

Fixed in https://github.com/squidfunk/mkdocs-material-insiders/pull/79 – the fixes are currently only in Insiders, so anybody having access can already test them. I still need to do some minor refactoring that shouldn't impact the functionality, and after that, I'll backport the fixes to the community edition. I just wanted to give them into the hands of users as soon as possible. This should resolve all known problems with instant loading, at least I've tested this and all other issues.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Jan 18, 2024
@squidfunk
Copy link
Owner

Fixes are now in #6662. Please check if the errors are now fixed when using this version in your project:

pip install git+https://github.com/squidfunk/mkdocs-material.git@fix/instant-loading-bugs

@squidfunk
Copy link
Owner

Released as part of 9.5.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants