mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
EditFolderDialog: Fix creating folders at the root level
This commit is contained in:
parent
7a9b7fec27
commit
d5134cb3ee
@ -43,14 +43,14 @@ export const EditFolderDialog = ({ onClose, folder, folderStructure }) => {
|
||||
const toggleNotification = useNotification();
|
||||
const [{ query }] = useQueryParams();
|
||||
const isEditing = !!folder;
|
||||
const activeFolderId = folder?.parent?.id ?? query?.folder ?? folderStructure[0].value;
|
||||
const activeFolderId = folder?.parent?.id ?? query?.folder;
|
||||
|
||||
const initialFormData = Object.assign({}, folder, {
|
||||
parent: {
|
||||
value: parseInt(activeFolderId, 10),
|
||||
label:
|
||||
findRecursiveFolderByValue(folderStructure, parseInt(activeFolderId, 10))?.label ??
|
||||
folderStructure[0].label,
|
||||
value: activeFolderId ? parseInt(activeFolderId, 10) : folderStructure[0].value,
|
||||
label: activeFolderId
|
||||
? findRecursiveFolderByValue(folderStructure, parseInt(activeFolderId, 10))?.label
|
||||
: folderStructure[0].label,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user