Skip to content

Commit

Permalink
fix: redirect to documents tab after multi-upload (#8342)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Oct 30, 2024
1 parent 07c7052 commit 82a87c8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions front/components/data_source/MultipleDocumentsUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export const MultipleDocumentsUpload = ({
}: MultipleDocumentsUploadProps) => {
const fileInputRef = useRef<HTMLInputElement>(null);
const [isLimitPopupOpen, setIsLimitPopupOpen] = useState(false);
const [clicked, setClicked] = useState(false);
useEffect(() => {
if (isOpen) {
if (isOpen && !clicked) {
fileInputRef.current?.click();
// Reset state immediately after opening the dialog, we don't need to keep it set
onClose(false);
setClicked(true);
}
}, [isOpen, onClose]);
}, [isOpen, onClose, clicked]);

const [isBulkFilesUploading, setIsBulkFilesUploading] = useState<null | {
total: number;
Expand Down
7 changes: 5 additions & 2 deletions front/components/spaces/ContentActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ export const ContentActions = React.forwardRef<
}, [currentAction, setCurrentDocumentId]);

const onClose = (save: boolean) => {
// Keep current to have it during closing animation
const action = currentAction.action;

// Clear the action
setCurrentAction({ contentNode: currentAction.contentNode });

if (save) {
onSave(currentAction.action);
onSave(action);
}
};

Expand Down
2 changes: 1 addition & 1 deletion front/components/spaces/FoldersHeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const AddDataDropDownButton = ({
onClick={() => {
contentActionsRef.current?.callAction("MultipleDocumentsUpload");
}}
label="Upload multiple files"
label="Upload multiple documents"
/>
</DropdownMenu.Items>
</DropdownMenu>
Expand Down

0 comments on commit 82a87c8

Please sign in to comment.