Skip to content

Commit

Permalink
fix: remove depth loop calls on folder's useEffect (#3535)
Browse files Browse the repository at this point in the history
🐛 (index.tsx): Fix issue where setEditFolderName was being called with undefined or empty folders array, causing a crash. Added a check to ensure folders array is not empty before setting edit folder names.
  • Loading branch information
Cristhianzl authored and anovazzi1 committed Aug 26, 2024
1 parent d1d8155 commit 8870e0e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ const SideBarFoldersButtonsComponent = ({
}

useEffect(() => {
setEditFolderName(folders.map((obj) => ({ name: obj.name, edit: false })));
if (folders && folders.length > 0) {
setEditFolderName(
folders.map((obj) => ({ name: obj.name, edit: false })),
);
}
}, [folders]);

const handleEditNameFolder = async (item) => {
Expand Down

0 comments on commit 8870e0e

Please sign in to comment.