Skip to content

Fix react(set-state-in-effect) lint warnings in ThreadPage and BotEditorPage #173

Description

@regnull

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

  • pnpm lint no longer reports these three warnings
  • No behavior change: switching threads or bots still resets the page state as it does today
  • pnpm test and pnpm typecheck pass, with a test added if a reset behavior wasn't covered before

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions