Skip to content

Remove unnecessary React hooks (CL-5351 slice B) - #324

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-5351-react-hooks
Aug 5, 2026
Merged

Remove unnecessary React hooks (CL-5351 slice B)#324
TheGreatAxios merged 3 commits into
mainfrom
cl-5351-react-hooks

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Derive permissionQueueDepth from queuedApprovals.length (one source of truth)
  • Adjust chat-input cursor and Work-panel expansion during render instead of effects
  • Reset plugins path suggestions at setAddingPath(null) exit sites
  • Write cursor ref during render in session-resume-picker
  • Cancel stale loadSentMessages loads on session switch/unmount

Part of CL-5351 high-priority React hooks cleanup (PR B of the suggested split). Event-log maxOffset/offset-ref items were already fixed on main.

Test plan

  • bun run typecheck
  • bun test src/tui/hooks/use-gates.test.ts tests/unit/tui/use-gates.test.tsx tests/unit/tui/chat-input.test.tsx
  • bun test src/tui/components/chat-input.test.ts src/tui/components/event-log.test.ts
  • Manual smoke: external value change jumps caret to end; mid-line typing keeps caret; goal implementing expands Work panel; Esc from plugins add-path clears suggestions

Closes nothing alone — tracks https://linear.app/abklabs/issue/CL-5351

@linear-code

linear-code Bot commented Aug 5, 2026

Copy link
Copy Markdown

CL-5351

@TheGreatAxios

Copy link
Copy Markdown
Collaborator Author

Hard review (greybeard + CTO)

Verdict: APPROVE

Greybeard

Dual-state queue depth removed; external-value cursor adjust is render-time (supported React pattern); plugins clear at call sites; message-pipeline load is cancellable. Net fewer effects, same behavior.

CTO

Clean slice B of CL-5351. Merge after or with the other 5351 slices; no product coupling.

No blockers.

Derive permission queue depth from queuedApprovals, adjust cursor and
Work-panel expansion during render, clear path suggestions at exit sites,
sync refs without effects, and cancel stale sent-history loads.

CL-5351 slice B.
Drop redundant `state` from use-stream effect/memo deps (the store object
is identity-stable). Document that telemetry and wait-for-approval local
state is seeded once from runner props; live updates go through setters
and onChange callbacks, not a prop sync effect.

CL-5351 slice B polish.
Share a generation counter between the hydrate effect and
startNewSession so a late loadSentMessages cannot overwrite
browse after a newer session load has already started.
@TheGreatAxios
TheGreatAxios merged commit 37fdb1e into main Aug 5, 2026
1 check 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