Switch from localstorage to IndexedDB for unbounded storage#18
Merged
dsfaccini merged 2 commits intopydantic:mainfrom Apr 6, 2026
Merged
Conversation
- Replace window.alert() with toast notifications (sonner) for storage errors - Change useLayoutEffect to useEffect for async message loading - Remove `as` typecasts from chat-db, use typed variables with eslint-disable at IDB/JSON.parse boundaries instead - Add db.onclose handler to reset cached dbPromise on connection loss - Defer localStorage cleanup in migration until all IDB writes succeed - Render app shell during migration instead of blank screen - Type messages as UIMessage[] end-to-end through chat-db Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
hey @prescod , appreciate the contrib! I had claude do a review and we found some points for potential improvement, so I'll push an update and merge later. thanks again! |
Contributor
|
Claude here: Pushed a follow-up commit with some improvements. Changes
|
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
IndexedDB is unlimited.
Maybe I should also implement warnings for when the chat crosses certain thresholds so you remember to delete your chats and not waste disk space? Let me know if you want that as a fast-follow PR.
But the old way was a hard limit that would crash a demo in the middle.
Fixes #17