Skip to content

fix(gen2): fix CI lint failure in turn-activity.tsx - #69

Merged
QA1S merged 2 commits into
mainfrom
explore/dark-mode-theme
Sep 28, 2026
Merged

QA1S merged 2 commits into
mainfrom
explore/dark-mode-theme

Conversation

@QA1S

@QA1S QA1S commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

react-hooks/set-state-in-effect flagged two setState calls in Gen2TurnActivity's "reset on empty" branches, spread across two separate effects that both fired on the exact same visible.length === 0 transition -- one calling setElapsed(0), the other calling setOpen(false) and duplicating the startedAt.current reset.

Merged the second effect into the first (real simplification, not just a lint workaround: one effect, one place resetting state on that transition, instead of two). The remaining setElapsed(0) call still trips the rule since it's genuinely synchronizing a ref-tracked wall-clock timer with an external prop change (items disappearing), which isn't expressible as derived render-time state -- disabled with a comment explaining why, matching the convention already used elsewhere in this codebase (e.g. chat-panel.tsx).

Verified: eslint . across apps/web now reports 0 errors (was 2), same 3 pre-existing unrelated warnings as before. turn-activity.test.tsx: 7/7 pass. tsc --noEmit clean.

QA1S and others added 2 commits September 28, 2026 01:14
react-hooks/set-state-in-effect flagged two setState calls in
Gen2TurnActivity's "reset on empty" branches, spread across two separate
effects that both fired on the exact same visible.length === 0
transition -- one calling setElapsed(0), the other calling setOpen(false)
and duplicating the startedAt.current reset.

Merged the second effect into the first (real simplification, not just a
lint workaround: one effect, one place resetting state on that
transition, instead of two). The remaining setElapsed(0) call still trips
the rule since it's genuinely synchronizing a ref-tracked wall-clock timer
with an external prop change (items disappearing), which isn't
expressible as derived render-time state -- disabled with a comment
explaining why, matching the convention already used elsewhere in this
codebase (e.g. chat-panel.tsx).

Verified: eslint . across apps/web now reports 0 errors (was 2), same 3
pre-existing unrelated warnings as before. turn-activity.test.tsx: 7/7
pass. tsc --noEmit clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
#	apps/web/components/gen2/turn-activity.tsx
@QA1S
QA1S merged commit 5654f16 into main Sep 28, 2026
3 checks passed
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