Feat/consolidate localstorage stores - #880
Open
Oluwasuyi-Oluwatimilehin-Daniel wants to merge 5 commits into
Open
Feat/consolidate localstorage stores#880Oluwasuyi-Oluwatimilehin-Daniel wants to merge 5 commits into
Oluwasuyi-Oluwatimilehin-Daniel wants to merge 5 commits into
Conversation
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
Oluwasuyi-Oluwatimilehin-Daniel
force-pushed
the
feat/consolidate-localstorage-stores
branch
from
July 30, 2026 21:43
9567233 to
4b62a1a
Compare
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
….com/Oluwasuyi-Oluwatimilehin-Daniel/ProofOfHeart-frontend into feat/consolidate-localstorage-stores
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#closes #835
PR: Consolidate localStorage-backed store modules into shared helper
Issue
#835 [Code Quality] Merge overlapping localStorage-backed store modules (commentStore, reportStore, adminLog) into a shared helper
Summary
This PR consolidates duplicate localStorage read/write/JSON-parse boilerplate across multiple modules into a single typed helper (
localStorageStore.ts). This makes future backend migration a single-point change instead of requiring changes across multiple files.Changes Made
New File
canUseStorage(): Checks if localStorage is availablegetItem<T>(): Reads and parses JSON from localStorage with error handlingsetItem<T>(): Writes values to localStorage as JSON with error handlinggetArray<T>(): Specialized array reader with validationsetArray<T>(): Specialized array writer with optional max entries limitremoveItem(): Removes items from localStorage with error handlingRefactored Files
canUseStorage(),readAllEntries(), andwriteAllEntries()with helper functionsreadNotificationIds()andwriteNotificationIds()with helper functionsFiles Not Modified (as expected)
Testing
npx tsc --noEmit)npm run format:check)window.matchMediaerrors in component testsThese failures existed before the changes and are not caused by the localStorage refactoring.
Benefits
Breaking Changes
None. This is a pure refactoring with no API changes.
Out of Scope
#closes