Fix: Dark mode toggles off on page refresh #499
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title and Issue number
Title : Dark mode gets turned off on refreshing page | Fixed
Description: This PR fixes the issue where the dark mode setting gets turned off when the page is refreshed. The theme preference is now properly saved and loaded from
localStorage
.Issue No. : #472
Close #472
Changes Made
The changes i made to this part of the code ensure that the theme is correctly initialized from
localStorage
and that any changes to the theme are persisted back tolocalStorage
. This allows the application to remember the user's theme preference even after the page is refreshed.Original Code:
Updated Code:
Screenshots
before
ShopNex.and.8.more.pages.-.Personal.-.Microsoft.Edge.2024-06-08.20-22-52.mp4
After
ShopNex.and.8.more.pages.-.Personal.-.Microsoft.Edge.2024-06-08.20-23-23.mp4
Checklist
I'm contributing this under GirlScript summer of code.
Please review my PR and let me know if any changes are required.