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

fix: themes broken when localStorage has invalid theme id stored #2463

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

Pistonight
Copy link
Contributor

Closes #2461

Check if stored theme is valid in get_theme() and defaults to default theme if not valid.

Validation steps:

  • cargo run -- build guide and serve the book
  • In browser devtools, run localStorage.setItem("mdbook-theme", "foo") to set an invalid theme foo
  • Refresh the page, themes should work properly:
    • the default theme should load
    • the theme popup functions properly

Manually tested in Google Chrome, MS Edge and Firefox (I don't have access to safari :(

Other:

  • localStorage won't be updated (i.e. keeps the invalid value) until user manually changes the theme

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Nov 1, 2024
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss added this pull request to the merge queue Nov 2, 2024
Merged via the queue into rust-lang:master with commit 47384c1 Nov 2, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Theme popup not opening when localStorage has an invalid theme id stored
3 participants