feat(terminal): migrate from zustand for console terminal logs to indexedDb, incr limit from 5mb to ~GBs#2812
Merged
waleedlatif1 merged 2 commits intostagingfrom Jan 14, 2026
Merged
Conversation
…exedDb, incr limit from 5mb to ~GBs
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR migrates console terminal logs from Zustand's default localStorage storage to IndexedDB using Key Changes:
Implementation Quality:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application Load
participant Storage as storage.ts
participant IDB as IndexedDB
participant LS as localStorage
participant Store as Zustand Store
participant Component as Terminal/Chat Component
Note over App,Component: Initial Load & Migration
App->>Storage: Module loads
Storage->>Storage: Start migrateFromLocalStorage()
Storage->>IDB: Check MIGRATION_KEY
alt Not migrated yet
Storage->>LS: Get terminal-console-store
LS-->>Storage: Return old data
Storage->>IDB: Write terminal-console-store
Storage->>LS: Remove terminal-console-store
Storage->>IDB: Write MIGRATION_KEY flag
end
Storage->>Storage: Clear migrationPromise
Note over Store,Component: Store Hydration
App->>Store: Initialize useTerminalConsoleStore
Store->>Storage: getItem from storage
Storage->>Storage: Wait for migrationPromise
Storage->>IDB: Read persisted data
IDB-->>Storage: Return data
Storage-->>Store: Return persisted state
Store->>Store: Rehydrate entries and isOpen
Store->>Store: Trigger onFinishHydration callback
Store->>Store: Update hasHydrated flag
Note over Component: Component Render
Component->>Store: Subscribe to hasHydrated flag
Component->>Store: Subscribe to entries
alt Not hydrated
Component->>Component: Render with empty entries
else Hydrated
Component->>Component: Render with entriesFromStore
end
Note over Store,IDB: Adding New Console Entry
App->>Store: addConsole new entry
Store->>Store: Process and trim entries
Store->>Storage: setItem auto-persist
Storage->>IDB: Write updated data
IDB-->>Storage: Success
Component->>Component: Re-render with new entry
|
Collaborator
Author
|
@greptile |
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.
Summary
Type of Change
Testing
Tested manually
Checklist