Skip to content

Fix #110: Refactor LocalStorageService to IndexedDB via localforage - #116

Open
adityakryadav wants to merge 1 commit into
akshay0611:mainfrom
adityakryadav:feature/issue-110
Open

Fix #110: Refactor LocalStorageService to IndexedDB via localforage#116
adityakryadav wants to merge 1 commit into
akshay0611:mainfrom
adityakryadav:feature/issue-110

Conversation

@adityakryadav

Copy link
Copy Markdown
Contributor

Closes #110.

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

@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 akshay0611 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.

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/removeItem on both the key and the history) are consistently migrated to localforage. No partial migration.
  • Encryption preserved — the AES-GCM encrypt/decrypt logic stays intact, and the getEncryptionKey pattern (caching via keyPromise) 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 🚫

  1. LocalStorageService.test.ts will break after mergesrc/services/LocalStorageService.test.ts on main mocks window.localStorage and accesses the mock directly (e.g., localStorageMock.getItem('symptom_checker_history')). After merging, the implementation uses localforage which stores values under prefixed keys in its localStorage driver fallback — so those direct mock assertions would return null. Please rebase on latest upstream main and update the test file to mock localforage directly instead of window.localStorage.

Suggestions 💡

  1. 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.

  2. Commit message — "Feature" is vague. Something like feat: migrate LocalStorageService from localStorage to IndexedDB via localforage would be more descriptive and match project conventions better.

Nits 🔧

  • The localforage.config() block is placed between the old localStorage comment 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!

@akshay0611

Copy link
Copy Markdown
Owner

@adityakryadav Is there's any update on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Refactor LocalStorageService to support IndexedDB for larger history sizes

2 participants