Details
The browser currently holds all tab state in-memory only (BrowserService uses an Arc<RwLock<BrowserState>>), so every app restart loses all open tabs, navigation history, and bookmarks. The SQLite infrastructure already exists from Phase 5 (sqlx + AppDb in services/memory/db.rs) — this feature layers browser-specific persistence on top of it.
Note: PR #78 attempted this using rusqlite (bundled), which conflicts with the existing sqlx driver. PR #78 should be closed in favour of this issue.
Implementation Notes
- Add
history, bookmarks, and tabs_session tables to migrations/001_initial.sql
- Expose IPC commands in
src-tauri/src/commands/browser.rs: db_add_history_entry, db_get_history, db_add_bookmark, db_remove_bookmark, db_get_bookmarks, db_save_session, db_restore_session
- Create
src/stores/dbStore.ts for history and bookmark actions using the existing AppDb pattern
- Add TypeScript models in
src/types/db.ts, re-export from src/types/index.ts
- Debounce
db_save_session in browserStore.ts on navigation/tab changes
- Call
db_restore_session on app launch in App.tsx
Acceptance Criteria
Details
The browser currently holds all tab state in-memory only (
BrowserServiceuses anArc<RwLock<BrowserState>>), so every app restart loses all open tabs, navigation history, and bookmarks. The SQLite infrastructure already exists from Phase 5 (sqlx+AppDbinservices/memory/db.rs) — this feature layers browser-specific persistence on top of it.Implementation Notes
history,bookmarks, andtabs_sessiontables tomigrations/001_initial.sqlsrc-tauri/src/commands/browser.rs:db_add_history_entry,db_get_history,db_add_bookmark,db_remove_bookmark,db_get_bookmarks,db_save_session,db_restore_sessionsrc/stores/dbStore.tsfor history and bookmark actions using the existingAppDbpatternsrc/types/db.ts, re-export fromsrc/types/index.tsdb_save_sessioninbrowserStore.tson navigation/tab changesdb_restore_sessionon app launch inApp.tsxAcceptance Criteria
historytable created anddb_add_history_entry/db_get_historycommands workbookmarkstable created and add/remove/get commands worktabs_sessiontable saves and restores open tabs across restartsApp.tsxrestores previous session on launch viadb_restore_sessiondbStore.tsexposes history and bookmark actions to the frontendsrc/types/db.tsand exported from indexsqlxAppDb— no new SQLite crate introduced