Skip to content

Commit

Permalink
Fix: file not get selected
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 committed Oct 27, 2023
1 parent e7cf0fe commit e5368fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/workspace/ExecuteFile/ExecuteFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ const ExecuteFile: FC<Props> = ({

const selectFile = (e: any) => {
const selectedFile = fileList.find((f) => {
if (typeof e === 'string') return f.id === e;
return f.id === e.target.value;
if (typeof e === 'string') return f?.id === e;
return f?.id === e?.target?.value;
});
setSelectedFile(selectedFile);
};

useEffect(() => {
setSelectedFile(fileList[0]);
}, [fileList]);
}, []);

return (
<div className={s.root}>
Expand Down

0 comments on commit e5368fc

Please sign in to comment.