11import { useAtomValue } from "@effect/atom-react" ;
22import type { EnvironmentId } from "@t3tools/contracts" ;
33import { isWindowsAbsolutePath } from "@t3tools/shared/path" ;
4- import { useMemo , useState } from "react" ;
4+ import { useState } from "react" ;
55
66import { primaryServerKeybindingsAtom } from "~/state/server" ;
77import { useTheme } from "~/hooks/useTheme" ;
@@ -48,23 +48,22 @@ export function ProjectFaviconPickerDialog(props: {
4848 ) ;
4949 const { resolvedTheme } = useTheme ( ) ;
5050 const keybindings = useAtomValue ( primaryServerKeybindingsAtom ) ;
51- const pickExternal = props . onPickExternal ;
51+ const { onPickExternal : pickExternal , onSelect } = props ;
5252 const fileManagerName = getLocalFileManagerName (
5353 typeof navigator === "undefined" ? "" : navigator . platform ,
5454 ) ;
55- const items = useMemo < CommandPaletteActionItem [ ] > (
56- ( ) =>
57- getProjectFilePickerMatches ( result . entries , result . matchedQuery ) . map ( ( match ) => ( {
58- kind : "action" ,
59- value : `project-favicon:${ match . path } ` ,
60- searchTerms : [ match . name , match . path ] ,
61- title : match . name ,
62- description : match . path ,
63- icon : < PierreEntryIcon pathValue = { match . path } kind = "file" theme = { resolvedTheme } /> ,
64- run : async ( ) => props . onSelect ( match . path ) ,
65- } ) ) ,
66- [ props . onSelect , resolvedTheme , result . entries , result . matchedQuery ] ,
67- ) ;
55+ const items : CommandPaletteActionItem [ ] = getProjectFilePickerMatches (
56+ result . entries ,
57+ result . matchedQuery ,
58+ ) . map ( ( match ) => ( {
59+ kind : "action" ,
60+ value : `project-favicon:${ match . path } ` ,
61+ searchTerms : [ match . name , match . path ] ,
62+ title : match . name ,
63+ description : match . path ,
64+ icon : < PierreEntryIcon pathValue = { match . path } kind = "file" theme = { resolvedTheme } /> ,
65+ run : async ( ) => onSelect ( match . path ) ,
66+ } ) ) ;
6867
6968 return (
7069 < CommandDialog open = { props . open } onOpenChange = { props . onOpenChange } >
@@ -89,7 +88,7 @@ export function ProjectFaviconPickerDialog(props: {
8988 . then ( ( path ) => {
9089 if ( ! path ) return ;
9190 props . onOpenChange ( false ) ;
92- props . onSelect ( path ) ;
91+ onSelect ( path ) ;
9392 } )
9493 . catch ( ( error : unknown ) => {
9594 toastManager . add ( {
0 commit comments