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 Aug 23, 2024
1 parent b63916e commit 0818d88
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 0818d88

Please sign in to comment.