Skip to content

Commit e0d6934

Browse files
committed
added check to restrict creation of files with same name inside same folder
1 parent 6a4c28a commit e0d6934

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

platform/firecamp-platform/src/components/activity-bar/explorer/menus/CollectionMenu.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,17 @@ const CollectionMenu = ({
6767

6868
const existingFolders = useExplorerStore.getState().explorer.folders;
6969
const parentFolderId = folderId || collectionId;
70-
// console.log(parentFolderId, "parentfolderid")
7170
const isDuplicateName = existingFolders.some(
72-
(folder) =>
73-
// console.log(`folder name ${folder.name} and folder parent id ${folder.__ref.collectionId}`),
74-
71+
(folder) =>
7572
folder.name === val && folder.__ref.collectionId === parentFolderId
76-
);
73+
);
7774

78-
if (isDuplicateName) {
79-
return {
80-
isValid: false,
81-
message: 'A folder with the same name already exists in this location.',
82-
};
83-
}
75+
if (isDuplicateName) {
76+
return {
77+
isValid: false,
78+
message: 'A folder with the same name already exists in this location.',
79+
};
80+
}
8481
return {
8582
isValid,
8683
message:

0 commit comments

Comments
 (0)