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

Javascript stops working on the website when the user's browser local storage has invalid value. #6645

Closed
4 tasks done
McDic opened this issue Jan 14, 2024 · 2 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@McDic
Copy link

McDic commented Jan 14, 2024

Context

We discussed about this bug here and @kamilkrzyskow suggested me to make an issue.

Bug description

If your browser has an invalid values like palette index in cache, the website will fail to load the whole Javascript stuffs.

I made a minimal standalone repository described on Reproduction section, so please have a look.

Related links

Reproduction

I made a repository to reproduce the exactly same thing on this repository. The steps are simple and you can follow and make exactly same .zip files.

Steps to reproduce

The content in this section is copied from this repository's README.md with slight modification.


Bug reproducing repository for mkdocs-material

This repository is used to introduce users to reproduce mkdocs-material bug discussed here.

Steps to reproduce in local

  1. Clone this repository.
  2. Make a virtual environment (Python 3.11) for this repository.
  3. Run pip install --upgrade --force-reinstall mkdocs-material to install mkdocs-material.
  4. Checkout to commit ff4d4cf.
  5. Run mkdocs serve in your terminal to turn on local server.
  6. Access 127.0.0.1:8000 from your browser.
  7. Press button on the website to make palette to the dark mode.
  8. Checkout to commit a0d3b0b and refresh your build (mkdocs serve will refresh automatically).
  9. Enjoy the bug. Javascript stuffs like searching, side navigations wouldn't work.

reproduced

Steps to reproduce .zip files

Since mkdocs-material encourages people to use .zip files made by info plugin instead of making a repository, I am going to make 2 .zip files.

  1. Run echo 2_palettes | mkdocs build -f mkdocs_2_palettes.yml
  2. Run echo 3_palettes | mkdocs build -f mkdocs_3_palettes.yml

Proposal to resolve this

I suggest to insert a validation JS code for invalid values in cache.

Browser

Edge

Before submitting

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Jan 14, 2024
@squidfunk
Copy link
Owner

Thanks for reporting! Fixed in d87c20f.

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels Jan 15, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.4.

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