@@ -203,13 +203,6 @@ function getOpenInIconClass(kind: OpenInOption["kind"]) {
203203 return cn ( kind === "brand" ? "text-foreground opacity-100" : "text-muted-foreground" ) ;
204204}
205205
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-
213206export const OpenInPicker = memo ( function OpenInPicker ( {
214207 environmentId,
215208 keybindings,
@@ -245,8 +238,6 @@ export const OpenInPicker = memo(function OpenInPicker({
245238 // the viewing machine, which only the desktop app can probe.
246239 const effectiveEditors = remote . mode === "local-exec" ? availableEditors : remoteCapableEditors ;
247240 const [ preferredEditor , setPreferredEditor ] = usePreferredEditor ( effectiveEditors ) ;
248- const options = useOpenInOptions ( effectiveEditors ) ;
249- const primaryOption = options . find ( ( { value } ) => value === preferredEditor ) ?? null ;
250241
251242 const openInEditor = ( editorId : EditorId | null ) => {
252243 if ( ! openInCwd ) return ;
@@ -313,6 +304,9 @@ export const OpenInPicker = memo(function OpenInPicker({
313304 preferredEditor ,
314305 remote . mode ,
315306 ] ) ;
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 ;
316310 const primaryLabel = isPanel ? `Open in ${ primaryOption ?. label ?? "editor" } ` : "Open" ;
317311
318312 const editorItems = (
0 commit comments