fix(gen2): fix CI lint failure in turn-activity.tsx - #69
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.