Skip to content

Fix/dark mode persistence - #772

Merged
komalharshita merged 3 commits into
komalharshita:mainfrom
Ayush-kathil:fix/dark-mode-persistence
Jun 8, 2026
Merged

Fix/dark mode persistence#772
komalharshita merged 3 commits into
komalharshita:mainfrom
Ayush-kathil:fix/dark-mode-persistence

Conversation

@Ayush-kathil

Copy link
Copy Markdown
Contributor

Resolves #746

Description

This pull request fixes a bug where the user's dark mode preference would reset to light mode on every page reload.

Changes Made

  • Updated initTheme() in static/script.js to retrieve the saved theme from localStorage if it exists.
  • Added a try/catch block around the localStorage call to prevent JavaScript execution errors for users with strict privacy settings that block local storage access.
  • If localStorage is empty or unavailable, it safely falls back to the data-theme attribute or defaults to "light".

Testing

  • Toggled dark mode on the homepage and refreshed the page; the dark theme persisted correctly.
  • Ensured the python tests/test_basic.py test suite passes successfully.

- Initialize global cache variables in data_loader.py
- Fix duplicate project IDs in projects.json
- Replace Django escapejs with Jinja tojson filter in project.html
@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

@Ayush-kathil is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working data type:accessibility ui and removed type:bug Something isn't working gssoc-2026 labels Jun 6, 2026

@komalharshita komalharshita left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks safe to merge!

@komalharshita
komalharshita merged commit 1d4effe into komalharshita:main Jun 8, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dark mode toggle resets to light mode on every page reload

2 participants