Fix #110: Refactor LocalStorageService to IndexedDB via localforage - #116
Fix #110: Refactor LocalStorageService to IndexedDB via localforage#116adityakryadav wants to merge 1 commit into
Conversation
|
@adityakryadav is attempting to deploy a commit to the Akshay Kumar's projects Team on Vercel. A member of the Team first needs to authorize it. |
akshay0611
left a comment
There was a problem hiding this comment.
Review: Fix #110: Refactor LocalStorageService to IndexedDB via localforage
This is a clean, well-scoped refactoring. The migration from localStorage to IndexedDB via localforage is complete and correct — every getItem/setItem/removeItem call was properly converted. Good work.
What looks great ✅
- Complete coverage — all 6 storage operations (
getItem/setItem/removeItemon both the key and the history) are consistently migrated tolocalforage. No partial migration. - Encryption preserved — the AES-GCM encrypt/decrypt logic stays intact, and the
getEncryptionKeypattern (caching viakeyPromise) is unchanged. - MAX_HISTORY_ENTRIES bump — 10 → 100 is sensible given IndexedDB's larger storage limits.
- No public API changes — consumers of
saveSymptomCheck,getSymptomHistory, etc. need zero changes. Minimal blast radius. - Error handling preserved — the try/catch fallback pattern is consistent with the original.
Blockers 🚫
- LocalStorageService.test.ts will break after merge —
src/services/LocalStorageService.test.tsonmainmockswindow.localStorageand accesses the mock directly (e.g.,localStorageMock.getItem('symptom_checker_history')). After merging, the implementation useslocalforagewhich stores values under prefixed keys in its localStorage driver fallback — so those direct mock assertions would returnnull. Please rebase on latest upstreammainand update the test file to mocklocalforagedirectly instead ofwindow.localStorage.
Suggestions 💡
-
PR description — "Closes #110" is correct but brief. Adding a sentence on what changed and why (e.g., "Replaced synchronous localStorage with async IndexedDB via localforage to remove the 10-entry quota and avoid blocking the main thread") would help reviewers understand scope at a glance.
-
Commit message — "Feature" is vague. Something like
feat: migrate LocalStorageService from localStorage to IndexedDB via localforagewould be more descriptive and match project conventions better.
Nits 🔧
- The
localforage.config()block is placed between the oldlocalStoragecomment and the constants. Consider moving it after the constants section so it doesn't interrupt the comment-to-variable flow.
Verdict
REQUEST_CHANGES — This is really close to being ready. The only hard requirement is updating the test file to work with the new localforage-based implementation so tests don't break on main after merge. Once that's addressed, this should be good to go. Nice work on a focused, well-executed refactoring!
|
@adityakryadav Is there's any update on it? |
e4ac313 to
1a9cb4b
Compare
Closes #110.