-
Notifications
You must be signed in to change notification settings - Fork 3
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
MR-3573: Download all contracts button does not generate zip file on first click #1859
MR-3573: Download all contracts button does not generate zip file on first click #1859
Conversation
…uments if viewing draft or previous submission.
Is it intentional that this submission on the review app generates an error? Error banner works: https://ddt0awkezsb2o.cloudfront.net/submissions/7055c843-32c2-48b0-b806-103488e3c291 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solid
} | ||
|
||
export const DownloadButton = ({ | ||
text, | ||
zippedFilesURL, | ||
}: DownloadButtonProps): React.ReactElement => { | ||
const handleClick = () => { | ||
if (zippedFilesURL) { | ||
window.open(zippedFilesURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we opening the link with JS? Shouldn't it be a simple Link in the end? Id worry about screen readers here going outside the normal semantics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Good call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}: ContractDetailsSummarySectionProps): React.ReactElement => { | ||
// Checks if submission is a previous submission | ||
const isPreviousSubmission = usePreviousSubmission() | ||
// Get the zip file for the contract | ||
const { getKey, getBulkDlURL } = useS3() | ||
const [zippedFilesURL, setZippedFilesURL] = useState<string>('') | ||
const [zippedFilesURL, setZippedFilesURL] = useState< | ||
string | undefined | Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -83,8 +93,14 @@ export const ContractDetailsSummarySection = ({ | |||
'HEALTH_PLAN_DOCS' | |||
) | |||
if (zippedURL instanceof Error) { | |||
console.info('ERROR: TODO: DISPLAY AN ERROR MESSAGE') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
]) | ||
|
||
const renderDownloadButton = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull this out into its own function, please. Anonymous functions that render JSX are how we got a lot of our Cypress flakes b/c the component is unmounted and remounted on every render.
@@ -174,7 +179,10 @@ export const RateDetailsSummarySection = ({ | |||
} | |||
} | |||
|
|||
useEffect(() => { | |||
useDeepCompareEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this switch for the flickering? Makes sense that this would be useful but referential equality seems to usually be good enough for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was switched because of infinite re-rendering. I think it is because of isPreviousSubmission
dependency, which is a hook and the referential equality was not enough.
]) | ||
const renderDownloadButton = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ibid
|
||
const documentsSummary = `${refreshedDocs.length} ${ | ||
refreshedDocs.length === 1 ? 'file' : 'files' | ||
}` | ||
// when there are no uncategorized supporting documents, remove this section entirely | ||
if (refreshedDocs.length === 0) return null | ||
|
||
const renderDownloadButton = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ibid
For the Q&A tests, we use direct API requests to make quick submissions, which does not upload files, just inserts a string in for the URL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me semantically!
Summary
MR-3573
Figma
This bug occurs when the
Download all
document button link is an empty string. There were two ways to reproduce this bug.Download all
before generating the bulk download URL was finished, and the linkBoth ways caused this bug because the code defaults the URL to an empty string. This empty link will then open a new tab with the submission summary page.
The fix was to add error handling and loading UI around generating the bulk URL.
Contract details
andRate details
section will first show aLoading
button. Once the bulk download URL has been generated, it will show theDownload all
button.getBulkDlURL
, then an inline warning will appear in place of theDownload all
button, and a warning banner will appear at the top of the page.ActionButton
component when displaying loading first.ActionButton
loading state size is larger then default size.fetchZipUrl
from executing onDRAFT
and previous submission view.Related issues
Screenshots
Test cases covered
DownloadButton.test.tsx
'renders loading button'
ContractDetailsSummarySection.test.tsx
,RateDetailsSummarySection.test.tsx
'renders inline error when bulk URL is unavailable'
SubmissionSummary.test.tsx
'renders document download warning banner'
QA guidance
getBulkDlURL
.Continue
orSave as Draft
buttons.