Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion client/src/components/DatasetProcessModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { Modal, ModalBody } from 'components/Modal'
export const DatasetProcessModal = ({
label = 'Download Dataset',
title = 'Download Dataset',
disabled = false
disabled = false,
onRedirecting = () => {}
}) => {
const { push } = useRouter()
const { processMyDataset } = useMyDataset()
Expand All @@ -22,10 +23,12 @@ export const DatasetProcessModal = ({
const submit = async () => {
const datasetRequest = await processMyDataset()
if (datasetRequest) {
onRedirecting(true)
push(`/datasets/${datasetRequest.id}`)
} else {
// TODO: Error handling
setSubmitting(false)
setShowing(false)
}
}

Expand Down
6 changes: 4 additions & 2 deletions client/src/pages/download/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Download = () => {
const { responsive } = useResponsive()

const [loading, setLoading] = useState(true)
const [redirecting, setRedirecting] = useState(false)
const [isFormatChanged, setIsFormatChanged] = useState(false)

const { hideNotification } = useNotification()
Expand Down Expand Up @@ -55,7 +56,8 @@ const Download = () => {
}
}, [loading])

if (loading) return <Loader />
// Show a loader while restoring scroll position or redirecting users
if (loading || redirecting) return <Loader />

// TODO: Replace this once error handling is finalized
// Show error page if there are any API errors
Expand All @@ -82,7 +84,7 @@ const Download = () => {
)}
</Box>
<Box>
<DatasetProcessModal />
<DatasetProcessModal onRedirecting={setRedirecting} />
<Text weight="bold">
Uncompressed size:{' '}
{formatBytes(myDataset.estimated_size_in_bytes)}
Expand Down