Commit c4125d2c authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed missing UploadsPage reload after deleting an upload.

parent b8a864c3
Pipeline #124209 passed with stages
in 34 minutes and 54 seconds
......@@ -41,6 +41,7 @@ import TooltipButton from '../utils/TooltipButton'
import ReloadIcon from '@material-ui/icons/Replay'
import Quantity from '../Quantity'
import { SourceApiCall, SourceApiDialogButton } from '../buttons/SourceDialogButton'
import { useHistory } from 'react-router-dom'
export const help = `
NOMAD allows you to upload data. After upload, NOMAD will process your data: it will
......@@ -255,6 +256,7 @@ export function UploadsPage() {
order_by: 'upload_create_time',
order: 'desc'
})
const history = useHistory()
const fetchData = useCallback(() => {
const {page_size, page, order_by, order} = pagination
......@@ -271,9 +273,12 @@ export function UploadsPage() {
fetchData()
}
// This history dependency makes sure that the uploads are reloaded after page navigating
// back to the UploadsPage. E.g. if an upload was deleted on the UploadPage, we are
// history.pushed back to the UploadsPage and want to reload the list of uploads.
useEffect(() => {
fetchData()
}, [fetchData])
}, [fetchData, history])
const isDisabled = unpublished ? (unpublished.pagination ? unpublished.pagination.total >= servicesUploadLimit : false) : false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment