Background
PR #407 fixed sidebar reorder on thread switch by stamping lastActivity in all invocation-clearing paths. The fix is correct and landed, but the stamping logic is now scattered across multiple store reducers:
removeActiveInvocation
clearAllActiveInvocations
clearAllThreadActiveInvocations
clearThreadActiveInvocation
resetThreadInvocationState
setHasActiveInvocation (true→false transition)
Two options:
-
Centralize into a helper: Extract a stampCompletion(state, threadId) helper that all clearing paths call, so the stamp logic lives in one place.
-
Make the clear API reason-aware: Add a reason parameter ('completion' vs 'repair') to the clear functions, so the stamp decision is explicit at the call site rather than implicit in each reducer.
Either approach would:
- Reduce repeated
Date.now() stamping across reducers
- Make the boundary between "real completion" and "stale repair" explicit
- Prevent future regressions if new clearing paths are added
References
Background
PR #407 fixed sidebar reorder on thread switch by stamping
lastActivityin all invocation-clearing paths. The fix is correct and landed, but the stamping logic is now scattered across multiple store reducers:removeActiveInvocationclearAllActiveInvocationsclearAllThreadActiveInvocationsclearThreadActiveInvocationresetThreadInvocationStatesetHasActiveInvocation(true→false transition)Proposal (from @zts212653 review on #407)
Two options:
Centralize into a helper: Extract a
stampCompletion(state, threadId)helper that all clearing paths call, so the stamp logic lives in one place.Make the clear API reason-aware: Add a
reasonparameter ('completion'vs'repair') to the clear functions, so the stamp decision is explicit at the call site rather than implicit in each reducer.Either approach would:
Date.now()stamping across reducersReferences