Skip to content

[Bug] TodoDock fires duplicate session-todos read on mount #1267

Description

@muzimu217

[Bug] TodoDock fires duplicate session-todos read on mount (0.15.10, main)

Problem / 问题

TodoDock triggers the session-todos read twice on mount for the same session, instead of once:

  1. useSessionTodosRecovery(sessionId) → startSessionTodosRecovery() → initial refresh() (recovery read);
  2. TodoDock's own mount effect → todosGet read (feature read).

Both hit todosGet for the identical sessionId on every dock mount/session switch. The recovery path was introduced with the checklist-recovery feature, so the duplicate is new behavior on current main.

Why it matters / 影响

  • Every session switch/activation costs a duplicate IPC round-trip to the host;
  • The recovery read and the feature read can race — the store revision fence protects correctness, but the duplicate still wastes host work and can produce flaky ordering in tests (a freshly-added test currently expects exactly one read on mount).

Suggested fix / 修复建议

Either:

  • Let useSessionTodosRecovery own the mount read and have TodoDock skip its own initial fetch when recovery is active; or
  • Deduplicate inside the store: applyTodosChanged/read wrapper drops the second in-flight todosGet for the same sessionId+revision window.

Reproduction / 复现

node --test apps/desktop/test/todo-recovery.test.mjs — the test TodoDock recovers a failed first read when the host returns without a session switch currently asserts reads deep-equals ["session-a"] after the first render+settle and fails with 2 !== 1 on current main (verified on a pristine checkout of e77404ea3, no local patches).

Note: this failure also means current main carries a red test in the desktop suite — flagging since the contributing CI workflow may not have run for the original PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions