Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): enable refetch on mount for storage responses #4821

Merged
merged 4 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const RESPONSE_TABLE_COLUMNS: Column<ResponseColumnData>[] = [
maxWidth: 100, // maxWidth is only used as a limit for resizing
},
{
Header: 'Reference ID',
Header: 'Response ID',
accessor: 'refNo',
minWidth: 200,
width: 300,
maxWidth: 240, // maxWidth is only used as a limit for resizing
},
{
Header: 'Submission time',
Header: 'Timestamp',
accessor: 'submissionTime',
minWidth: 200,
width: 300,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const SubmissionSearchbar = ({
onChange={setInputValue}
onCollapseIconClick={() => setSubmissionId(null)}
onSearch={setSubmissionId}
placeholder="Search by reference ID"
placeholder="Search by response ID"
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export const UnlockedResponses = (): JSX.Element => {
mb="1rem"
alignItems="end"
color="secondary.500"
gridTemplateColumns={{ base: 'auto', md: 'auto 1fr' }}
gridGap={{ base: '0.5rem', md: '1.5rem' }}
gridTemplateColumns={{ base: 'auto 1fr', lg: 'auto 1fr auto' }}
gridGap="0.5rem"
gridTemplateAreas={{
base: "'submissions' 'export'",
md: "'submissions export'",
base: "'submissions search' 'export export'",
lg: "'submissions search export'",
}}
>
<Stack
Expand All @@ -67,19 +67,29 @@ export const UnlockedResponses = (): JSX.Element => {
</Text>
</Skeleton>
</Stack>
<Stack direction="row" gridArea="export" justifySelf="end">

<Flex gridArea="search" justifySelf="end">
<SubmissionSearchbar
submissionId={submissionId}
setSubmissionId={setSubmissionId}
isAnyFetching={isAnyFetching}
/>
</Flex>

<Stack
direction={{ base: 'column', sm: 'row' }}
justifySelf={{ base: 'start', sm: 'end' }}
gridArea="export"
>
<DateRangeInput value={dateRange} onChange={setDateRange} />
<DownloadButton />
</Stack>
</Grid>

<Box mb="3rem" overflow="auto" flex={1}>
<ResponsesTable />
</Box>

<Box display={isLoading || countToUse === 0 ? 'none' : ''}>
<Pagination
totalCount={countToUse ?? 0}
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/features/admin-form/responses/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ export const useFormResponses = ({
adminFormResponsesKeys.metadata(formId, params),
() => getFormSubmissionsMetadata(formId, params),
{
refetchOnMount: true,
refetchOnWindowFocus: false,
// Data will never change.
staleTime: Infinity,
keepPreviousData: !submissionId,
justynoh marked this conversation as resolved.
Show resolved Hide resolved
enabled: !!secretKey && (page > 0 || !!submissionId),
},
Expand Down