diplodoc-platform / diplodoc-platform/client

Save Theme Preference Using LocalStorage Instead of SessionStorage

Open
#92 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
3
Forks
7
Avg merge
21h 21m
Merged PRs (30d)
17

Description

Currently, the theme preference (light/dark mode) for static documentation is being saved in sessionStorage, causing the user-selected theme to reset when the browser/tab is closed. Instead, we should use localStorage to persist the theme preference across sessions, ensuring a consistent user experience.

**Steps to Reproduce:**
1. Change the website theme from the default to another (e.g., from light to dark).
2. Close the browser or tab.
3. Reopen the browser or tab and revisit the website.

**Expected Behavior:**
The website should retain the user's theme preference (light or dark mode) upon reopening the browser.

**Actual Behavior:**
The theme resets to the default as the preference is stored in sessionStorage.

**Proposed Solution:**
- Update the code to store the theme preference in localStorage instead of sessionStorage.
- Ensure that the theme preference is retrieved from localStorage on page load.

Code Context:
https://github.com/diplodoc-platform/client/blob/476ae92cd636c5967df3480e2474aee6b7cde3c8/src/utils.ts#L116

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.