Skip to content

Conflicts store loads from the default database at startup and is not reloaded on database switch #3067

Closed

Description

@malibio

Problem

app-shell.svelte's loadConflicts() calls conflictsStore.load() (list_conflicts, a routed command) in onMount, alongside databaseStore.load(). When the restored database is not the daemon default, that call goes out before routing is set, so the startup "N unresolved conflicts" notice and the cached conflictsStore.records reflect the default database's journal.

A database switch has the same gap: switchTo / evictAndReloadActiveDatabase never reloads conflictsStore, so its records keep describing the previous database until the Conflicts view is opened (which reloads).

conflictsStore.load() has no generation guard, so calling it again on a switch is not enough on its own: a stale in-flight load can resolve after the reload and overwrite it.

Suggested fix

  • Add a generation guard to conflictsStore.load() plus an invalidateForDatabaseSwitch(), matching the collections/schemas/ai-chats stores.
  • Call invalidate + load from databaseStore.evictAndReloadActiveDatabase().
  • Start the startup conflicts notice only after databaseStore has a selection, so its count describes the routed database.

Acceptance Criteria

  • After launching into a non-default database, the startup conflicts notice counts that database's open conflicts
  • After a database switch, conflictsStore.records describes the new database
  • A conflicts load issued before a switch cannot overwrite the post-switch records

Activity

  1. malibio commented on Sep 26, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 5366 passed, 1 failed (architecture-benchmarks perf threshold, known load-flaky)

  2. self-assigned this
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions