From c426fecf4380a99be3e6268e07a78e7e7756f84f Mon Sep 17 00:00:00 2001 From: Atharva Ombase <94031822+atharvaombase@users.noreply.github.com> Date: Sat, 19 Apr 2025 18:53:34 +0530 Subject: [PATCH] Feat:Added the isUploading in the useEffect for re-rendering file table when new file/folder is uploaded --- Frontend/src/components/FileList.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Frontend/src/components/FileList.jsx b/Frontend/src/components/FileList.jsx index b166337..8817562 100644 --- a/Frontend/src/components/FileList.jsx +++ b/Frontend/src/components/FileList.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from "react"; import PropTypes from "prop-types"; -import { useDispatch } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { setCurrentPath } from "../store/pathSlice"; import { FileText, @@ -26,7 +26,7 @@ const FileTable = ({ initialPath }) => { const [currentPath, setCurrentPathState] = useState(initialPath || "/"); const [files, setFiles] = useState([]); const dispatch = useDispatch(); - + const isUploading = useSelector((state) => state.upload.isUploading); const getType = (entry) => entry.trim().startsWith("📁") ? "Folder" : "File"; @@ -120,7 +120,7 @@ const FileTable = ({ initialPath }) => { useEffect(() => { dispatch(setCurrentPath(currentPath)); fetchFiles(); - }, [currentPath]); + }, [currentPath, dispatch, isUploading]); const handleOpenFolder = (folderName) => { const newPath = @@ -164,7 +164,10 @@ const FileTable = ({ initialPath }) => { ); if (match) downloadedFileName = match[1]; } - + console.log( + `${API_URL}/api/hdfs/downloadFile?hdfsEncPath=${hdfsPath}&localPath=${name}&username=${username}`, + authToken + ); const blob = await response.blob(); const blobUrl = window.URL.createObjectURL(blob); const link = document.createElement("a");