The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): the open-in picker keeps its caching without "use memo" hooks (#20758)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 23:27 UTC
83ffe0a8e0a1b7e45af82cb604eb3568f37baa5d
1 file changed
+3
-9
apps/web/src/components/chat/OpenInPicker.tsx
+3
-9
@@ -203,13 +203,6 @@ function getOpenInIconClass(kind: OpenInOption["kind"]) {
203
return cn(kind === "brand" ? "text-foreground opacity-100" : "text-muted-foreground");
204
}
205
206
-// Resolving filters and labels every known editor; the compiler would redo
207
-// it every render because the open command hooks follow it.
208
-function useOpenInOptions(editors: ReadonlyArray<EditorId>) {
209
- "use memo";
210
- return resolveOpenInOptions(navigator.platform, editors);
211
-}
212
-
206
export const OpenInPicker = memo(function OpenInPicker({
207
environmentId,
208
keybindings,
@@ -245,8 +238,6 @@ export const OpenInPicker = memo(function OpenInPicker({
238
// the viewing machine, which only the desktop app can probe.
239
const effectiveEditors = remote.mode === "local-exec" ? availableEditors : remoteCapableEditors;
240
const [preferredEditor, setPreferredEditor] = usePreferredEditor(effectiveEditors);
248
- const options = useOpenInOptions(effectiveEditors);
249
- const primaryOption = options.find(({ value }) => value === preferredEditor) ?? null;
241
242
const openInEditor = (editorId: EditorId | null) => {
243
if (!openInCwd) return;
@@ -313,6 +304,9 @@ export const OpenInPicker = memo(function OpenInPicker({
304
preferredEditor,
305
remote.mode,
306
]);
307
+ // Derived after the shortcut effect so the compiler can cache the resolved editor list.
308
+ const options = resolveOpenInOptions(navigator.platform, effectiveEditors);
309
+ const primaryOption = options.find(({ value }) => value === preferredEditor) ?? null;
310
const primaryLabel = isPanel ? `Open in ${primaryOption?.label ?? "editor"}` : "Open";
311
312
const editorItems = (