State Management

The application relies exclusively on Svelte 5 runes ($state, $derived, $effect) for reactivity, replacing all legacy Svelte stores.

Svelte Runes

State is encapsulated in singleton classes or closures exported from src/lib/state/.

  • issuesStore.svelte.ts: Holds the normalized Map of all issues.
  • configStore.svelte.ts: Holds user preferences (theme, view mode).
  • modeStore.svelte.ts: Tracks whether the user is in Local or Remote edit mode.

Commit Queue

To avoid rate-limiting GitHub's API during rapid typing, all I/O mutations are routed through a Debounced Commit Queue.

Performance
The Commit Queue groups multiple edits to the same file within a 2-second window into a single Git commit.

Optimistic Updates

When a user edits an issue:

  1. The UI calls issuesStore.updateIssue(id, payload).
  2. The store updates the rune immediately. The UI re-renders synchronously.
  3. The store pushes a WriteTask into the Commit Queue.
  4. If the remote write fails, the Commit Queue triggers a rollback in the issuesStore and shows a toast error.