Skip to content

[FEATURE] Browser History, Bookmarks & Tab Session Persistence #84

Description

@Wombatfreak6

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

  • history table created and db_add_history_entry / db_get_history commands work
  • bookmarks table created and add/remove/get commands work
  • tabs_session table saves and restores open tabs across restarts
  • App.tsx restores previous session on launch via db_restore_session
  • dbStore.ts exposes history and bookmark actions to the frontend
  • TypeScript types defined in src/types/db.ts and exported from index
  • Uses existing sqlx AppDb — no new SQLite crate introduced
  • Existing Vitest and Rust unit tests continue to pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions