Skip to content

Commit 2d23dae

Browse files
committed
Fix stale ref reads in ChatComposer and remove dead probeCodexAccount export
- Move composerMenuOpenRef, composerMenuItemsRef, and activeComposerMenuItemRef assignments back to synchronous render phase instead of useEffect, preventing stale reads during fast keypresses between render commit and effect execution. - Remove unused probeCodexAccount function from codexAppServer.ts (replaced by probeCodexDiscovery at all call sites).
1 parent ebbf325 commit 2d23dae

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

apps/server/src/provider/codexAppServer.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,3 @@ export async function probeCodexDiscovery(input: {
244244
});
245245
});
246246
}
247-
248-
export async function probeCodexAccount(input: {
249-
readonly binaryPath: string;
250-
readonly homePath?: string;
251-
readonly signal?: AbortSignal;
252-
}): Promise<CodexAccountSnapshot> {
253-
return (
254-
await probeCodexDiscovery({
255-
...input,
256-
cwd: process.cwd(),
257-
})
258-
).account;
259-
}

apps/web/src/components/chat/ChatComposer.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,11 +820,9 @@ export const ChatComposer = memo(
820820
[composerHighlightedItemId, composerMenuItems],
821821
);
822822

823-
useEffect(() => {
824-
composerMenuOpenRef.current = composerMenuOpen;
825-
composerMenuItemsRef.current = composerMenuItems;
826-
activeComposerMenuItemRef.current = activeComposerMenuItem;
827-
}, [activeComposerMenuItem, composerMenuItems, composerMenuOpen]);
823+
composerMenuOpenRef.current = composerMenuOpen;
824+
composerMenuItemsRef.current = composerMenuItems;
825+
activeComposerMenuItemRef.current = activeComposerMenuItem;
828826

829827
const nonPersistedComposerImageIdSet = useMemo(
830828
() => new Set(nonPersistedComposerImageIds),

0 commit comments

Comments
 (0)