File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1- import { useEffect , useRef , useState } from 'react'
1+ import { useEffect , useMemo , useRef , useState } from 'react'
22import { useConfig } from '../hooks/useConfig.js'
33import type { DirSource , FileMetadata } from '../lib/sources/types.js'
44import { cn , formatFileSize , getFileDate , getFileDateShort } from '../lib/utils.js'
@@ -35,7 +35,10 @@ export default function Folder({ source }: FolderProps) {
3535 } , [ source ] )
3636
3737 // File search
38- const filtered = files ?. filter ( file => file . name . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) )
38+ const filtered = useMemo ( ( ) => {
39+ return files ?. filter ( file => file . name . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) )
40+ } , [ files , searchQuery ] )
41+
3942 useEffect ( ( ) => {
4043 const searchElement = searchRef . current
4144 function handleKeyup ( e : KeyboardEvent ) {
You can’t perform that action at this time.
0 commit comments