Skip to content

perf(thread): stabilize goal dock state and floor elapsed seconds - #690

Merged
SDSLeon merged 1 commit into
masterfrom
fix/goal-bubble-timer-rerender
Sep 3, 2026
Merged

perf(thread): stabilize goal dock state and floor elapsed seconds#690
SDSLeon merged 1 commit into
masterfrom
fix/goal-bubble-timer-rerender

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Fixes the goal bubble timer ticking faster than real time and re-rendering on every streamed chat message.

  • selectThreadGoalDockState returns the cached reference when recomputed fields are identical, so Zustand subscribers don't re-render on unrelated transcript appends.
  • useGoalElapsedSeconds effect keyed on timing primitives (status, timeUsedSeconds, updatedAt, sourceItemId) instead of state object identity.
  • resolveGoalElapsedSeconds uses Math.floor instead of Math.round so the displayed second never flips early (consistent with the chat Working-for timer).

Tests: new threadGoalTiming.test.ts + selector stability tests in threadGoalState.test.ts; full src/renderer/components/thread suite green (933 passed); typecheck/lint/fmt clean.

- Reuse cached dock-state refs when unrelated chat items arrive
- Key goal timer effects on timing fields, not state identity
- Floor elapsed seconds so the bubble does not tick early
- Add selector stability and elapsed-second unit tests
@SDSLeon
SDSLeon merged commit efdbb69 into master Sep 3, 2026
8 checks passed
@SDSLeon
SDSLeon deleted the fix/goal-bubble-timer-rerender branch September 3, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant