githubnext/chopinPublic

Let's compose rich plans together

fix(editor): adjust callout picker state during render, not effect

The callout Heading component reset the type-picker's open state in a
useEffect keyed on the disabled prop. This is the classic
reset-or-adjust-state anti-pattern: an effect runs after commit purely
to derive one piece of state from a prop, causing an extra render.

Replaced with the render-time adjustment pattern React recommends:
track the previous disabled value in state and close the picker
during render when it changes, avoiding the extra render pass entirely.

Verification: bun run types (all packages pass), bun test packages/editor
(303 pass, 0 fail), oxlint on the changed file (0 warnings/errors).
bun run ci could not complete in this sandbox because dprint's plugin
download is blocked by network policy; unrelated to this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
COGAgithub-actions[bot] and Copilot authored committed by GitHub
5fd6647Patch
Parentef8735a
1 file changed+7-4
StackedSplit
packages/editor/src/widgets/callout.tsx+7 −4