Goal
Fix the three react(set-state-in-effect) warnings reported by pnpm lint.
Context
Running cd frontend && pnpm lint reports:
src/pages/ThreadPage.tsx:52:5 react(set-state-in-effect)
src/pages/ThreadPage.tsx:74:7 react(set-state-in-effect)
src/pages/BotEditorPage.tsx:43:107 react(set-state-in-effect)
Calling setState synchronously inside useEffect triggers an extra render. The usual fix is to derive the value during render, initialize the state directly, or reset it by giving the component a key. See React's You Might Not Need an Effect.
Acceptance criteria
Goal
Fix the three
react(set-state-in-effect)warnings reported bypnpm lint.Context
Running
cd frontend && pnpm lintreports:Calling
setStatesynchronously insideuseEffecttriggers an extra render. The usual fix is to derive the value during render, initialize the state directly, or reset it by giving the component akey. See React's You Might Not Need an Effect.Acceptance criteria
pnpm lintno longer reports these three warningspnpm testandpnpm typecheckpass, with a test added if a reset behavior wasn't covered before