Skip to content

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

@McDic

Description

@McDic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions