Skip to content

feat: consolidate store keys to TinyBase#3554

Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1770014562-consolidate-store-keys
Open

feat: consolidate store keys to TinyBase#3554
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1770014562-consolidate-store-keys

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 2, 2026

feat: consolidate store keys to TinyBase

Summary

Consolidates three frontend-only store keys (PinnedTabs, RecentlyOpenedSessions, DismissedToasts) from separate Rust-side persistence into TinyBase values. This eliminates redundant boilerplate code and simplifies the architecture by keeping frontend-only state entirely in the frontend.

Changes:

  • Added pinned_tabs, recently_opened_sessions, dismissed_toasts to TinyBase schema
  • Replaced Zustand middleware (pinnedPersistenceMiddleware, recentlyOpenedMiddleware) with React hooks (usePinnedTabsSync, useRecentlyOpenedSync)
  • Replaced React Query in useDismissedToasts with TinyBase useValue
  • Removed 3 Rust StoreKey variants and 6 Tauri commands
  • Added guidance comment in store.rs for future frontend-only values

Closes #3553

Updates since last revision

  • Fixed race condition in tab restoration: The layout now waits for TinyBase pinned_tabs value to load before checking if an empty tab needs to be opened. Without this fix, users with pinned tabs would see a flash of an empty tab on startup before their pinned tabs were restored.
  • Removed dead code: Deleted unused restorePinnedTabsToStore and restoreRecentlyOpenedToStore functions from pinned-persistence.ts and recently-opened.ts
  • Added documentation comment explaining the race condition fix in _layout.tsx

Review & Testing Checklist for Human

  • Tab restoration on startup: Launch the app with existing pinned tabs and verify they restore correctly without a flash of empty tab
  • Data migration: Existing users will lose their pinned tabs, recently opened sessions, and dismissed toasts on upgrade. Verify this is acceptable or add migration logic.
  • Cross-window sync: The new approach uses TinyBase's BroadcastChannel synchronizer instead of Tauri IPC. Test that changes sync correctly between main window and other windows.
  • Persistence verification: Manually test that pinned tabs, recently opened sessions, and dismissed toasts persist correctly across app restarts.

Recommended test plan:

  1. Launch the app fresh (no existing data)
  2. Pin some tabs, open several sessions, dismiss a toast
  3. Restart the app and verify all state persists
  4. Open a second window and verify changes sync between windows

Notes


Open with Devin

- Add pinned_tabs, recently_opened_sessions, dismissed_toasts to TinyBase schema
- Replace pinnedPersistenceMiddleware with usePinnedTabsSync hook
- Replace recentlyOpenedMiddleware with useRecentlyOpenedSync hook
- Replace React Query in useDismissedToasts with TinyBase useValue
- Remove unused Rust StoreKey variants (DismissedToasts, PinnedTabs, RecentlyOpenedSessions)
- Remove corresponding Rust commands and ext traits
- Add guidance comment for frontend-only values

Closes #3553

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@netlify
Copy link

netlify bot commented Feb 2, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 7781361
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/698065a0f74d7200083e2a08

@netlify
Copy link

netlify bot commented Feb 2, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 7781361
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/698065a03b943000082284b6

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View issue and 4 additional flags in Devin Review.

Open in Devin Review

devin-ai-integration bot and others added 2 commits February 2, 2026 07:40
- Fix race condition: sync hooks now reactively wait for TinyBase values
  to be loaded before initializing state from persistence
- Fix prevRef update: update refs outside the main window check to avoid
  stale comparisons in non-main windows
- Remove restore functions from _layout.tsx since sync hooks now handle
  initialization internally
- Simplify initialization logic in _layout.tsx

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
- Wait for TinyBase pinned_tabs value to load before checking if empty tab needed
- Remove unused restorePinnedTabsToStore and restoreRecentlyOpenedToStore functions
- Add documentation comment explaining the race condition fix

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
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.

Remove unnecessary enum variants from apps/desktop/src-tauri/src/store.rs

1 participant