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

fix(app): Improve ODD "run again" behavior #14102

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Dec 6, 2023

Closes RQA-1972, RQA-1973

Overview

This PR adds a loading state to the "Run Again" button on the ODD.

It also fixes a routing bug in which pressing "run again" would send the user to the protocol setup page, back to the /protocols page, then back to the protocol setup page. Changes to TopLevelRedirect did not account for ODD "run again" routing logic. By removing the onResetSuccess callback, we avoid the superfluous redirect.

Current Behavior

IMG_3829.MOV

Fixed Behavior

Screen.Recording.2023-12-06.at.9.54.40.AM.mov

Test Plan

  • Follow the video flow above. Just verify that there's loading state and there is no redirection to the /protocols route after pressing "run again".

Changelog

  • Added loading state to the "Run again" button the ODD.
  • Fixed a routing issue when pressing "Run again" on the ODD.

Risk assessment

low

Changes to TopLevelRedirect did not account for ODD "run again" routing logic. By removing the
onResetSuccess callback, we avoid the superfluous redirect.
@mjhuff mjhuff requested a review from a team December 6, 2023 15:03
@mjhuff mjhuff requested a review from a team as a code owner December 6, 2023 15:03
@mjhuff mjhuff requested review from jerader and removed request for a team December 6, 2023 15:03
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Merging #14102 (61cdc12) into chore_release-7.1.0 (d7646ac) will decrease coverage by 0.01%.
Report is 9 commits behind head on chore_release-7.1.0.
The diff coverage is 14.28%.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           chore_release-7.1.0   #14102      +/-   ##
=======================================================
- Coverage                70.46%   70.46%   -0.01%     
=======================================================
  Files                     2512     2512              
  Lines                    71196    71203       +7     
  Branches                  8958     8963       +5     
=======================================================
+ Hits                     50168    50172       +4     
- Misses                   18837    18840       +3     
  Partials                  2191     2191              
Flag Coverage Δ
app 67.66% <14.28%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
app/src/pages/OnDeviceDisplay/RunSummary.tsx 9.63% <14.28%> (+0.77%) ⬆️

... and 3 files with indirect coverage changes

@@ -197,6 +198,19 @@ export function RunSummary(): JSX.Element {
})
}, [])

const RUN_AGAIN_SPINNER_TEXT = (
Copy link
Contributor Author

@mjhuff mjhuff Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't as clean as I'd like. If we end up using the spinner icon in the upper-right corner as a pattern on the ODD, we should extend the large button component to support a spinner.

The only other place we use a spinner on click on the ODD is the recently run protocols page, but we don't use a button there. I think this is another spot that we could refactor to use a new large button w/ loading spinner component.

But yeah, out of scope for this PR. I'll probably ticket this for future work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should refactor large button to support a spinner!

Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I think we should definitely refactor LargeButton to support a spinner and the spinner css state. Looks like LargeButton is only used in this component so I think it'd be a quick refactor. But feel free to make a follow up ticket for that instead to do post-launch!

const DURATION_TEXT_STYLE = css`
font-size: ${TYPOGRAPHY.fontSize22};
line-height: ${TYPOGRAPHY.lineHeight28};
font-weight: ${TYPOGRAPHY.fontWeightRegular};
`

const RUN_AGAIN_CLICKED_STYLE = css`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels a bit weird to me that LargeButton would special case a css prop for when the spinner is showing, given that LargeButton is meant to be a design component that encompasses all the stylings. Looks like LargeButton is only used in this component so I think its safe to move this to be directly in LargeButton.

@@ -197,6 +198,19 @@ export function RunSummary(): JSX.Element {
})
}, [])

const RUN_AGAIN_SPINNER_TEXT = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should refactor large button to support a spinner!

@mjhuff
Copy link
Contributor Author

mjhuff commented Dec 6, 2023

lgtm, I think we should definitely refactor LargeButton to support a spinner and the spinner css state. Looks like LargeButton is only used in this component so I think it'd be a quick refactor. But feel free to make a follow up ticket for that instead to do post-launch!

Thanks for your feedback! I didn't notice that we are using LargeButton only here... I'm going to ticket this out separately, because the more I think through it, the more it seems like this should involve some architecting. 🎨

@mjhuff mjhuff merged commit 4aced90 into chore_release-7.1.0 Dec 6, 2023
29 of 30 checks passed
@mjhuff mjhuff deleted the app_improve-odd-run-again-behavior branch December 6, 2023 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants