diff --git a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx index d096f90a2..da77492ae 100644 --- a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -39,6 +39,17 @@ export default function AddFileCombobox({ } }, []); + useEffect(() => { + // update selectedFiles showing only the files that are in codeToEdit + setSelectedFiles( + (prevSelectedFiles) => + prevSelectedFiles.filter( + (file) => + codeToEdit.findIndex((code) => code.filepath === file.id) !== -1, + ), + ); + }, [codeToEdit]); + const filteredFiles = query === "" ? remainingFiles