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): fix infinitely re-rendering/never rendering firmware success toasts #14981

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Apr 23, 2024

Closes RQA-2588

Overview

There are two issues with rendering firmware update toasts.

First, the toasts depend on a request id stored as state within the ModuleCard, but ModuleCards most often unrender during the firmware update process, so this state is lost. This causes the toast never to render.

The second issue is that sometimes, given the timing of the polling for attached modules, the module is always attached during the firmware update, thereby causing the module card not to unrender. When this happens, the useEffect hook responsible for making the success toast has conditional logic that is always true after an update, causing the toast to render infinitely.

The solution to both these problems is to lift the request id state out of the module card itself and then abstract away the storage/retrieval via a utility hook, which is utilized by all parent components of ModuleCard.

Current Behavior

2024-04-17_09-48-08.mp4

Fixed Behavior

Screen.Recording.2024-04-23.at.11.19.12.AM.mov

Test Plan

  • Update a module's firmware then verify the update successful toast renders once. Let me know if you need help downgrading a module to test!

Changelog

  • Firmware update toasts now work.

Risk assessment

low

…s toast

There are two issues with rendering firmware update toasts. First, the toasts depend on a request id
stored as state within the ModuleCard, but ModuleCards most often unrender during the firmware
update process, so this state is lost. This causes the toast never to render. The second issue is
that sometimes, given the timing of the polling for attached modules, the module is always attached
during the firmware update, thereby causing the module card not to unrender. When this happens, the
useEffect hook responsible for making the success toast has conditional logic that is always true
after an update, causing the toast to render infinitely. The solution to both these problems is to
lift the request id state out of the module card itself and then abstracta way the storage/retrieval
via a utility hook, which is utilized by all parent components of ModuleCard.
@mjhuff mjhuff requested review from a team April 23, 2024 15:23
@mjhuff mjhuff requested a review from a team as a code owner April 23, 2024 15:23
@mjhuff mjhuff requested review from koji and removed request for a team April 23, 2024 15:23
Copy link
Contributor

@koji koji left a comment

Choose a reason for hiding this comment

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

lgtm

thank you for teaching me the way to downgrade module version.

@mjhuff mjhuff merged commit ce97b91 into edge Apr 23, 2024
26 checks passed
@mjhuff mjhuff deleted the app_fix-firmware-toast-rendering branch April 23, 2024 16:09
y3rsh added a commit that referenced this pull request Apr 23, 2024
* edge: (194 commits)
  fix(app): clone run with RTPs from HistoricalProtocolRun (#14959)
  fix(api): Filter out `air_gap()` calls as higher-order commands (#14985)
  fix(app): fix infinitely re-rendering/never rendering firmware success toasts (#14981)
  feat(api): add option to ignore different tip presence states (#14980)
  feat(opentrons-ai-client) add input textbox to container (#14968)
  fix(app): add robotSerialNumber to proceedToRun event (#14976)
  fix(api): remove homing patch fix for right mount when a 96-channel is attached (#14975)
  feat(api-client,app,react-api-client): upload splash logo from desktop app (#14941)
  fix(robot-server): notify /runs when a non-current run is deleted (#14974)
  feature(api, robot-server): Allow fixit commands to recover from an error (#14908)
  feat(hardware-testing): enable multi sensor processing in liquid probe (#14883)
  fix(app): prevent "run again" banner from rendering after navigating away from the current run (#14973)
  refactor(components): refactor roundtab stories (#14956)
  refactor(protocol-designer): assign module slot in createFileWizard instead of modal (#14951)
  fix(app, api-client): fix choose protocol slideout issue (#14949)
  refactor(protocol-designer): tip position modal max values round down (#14972)
  feat(app): add tiprack selection step to quick transfer flow (#14950)
  ci(shared-data): install dependencies in workflow (#14958)
  fix(components): fix icon stories (#14969)
  feat(opentrons-ai-client): introduce react-markdown to chat display component (#14965)
  ...
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
…s toasts (#14981)

Closes RQA-2588

There are two issues with rendering firmware update toasts.

First, the toasts depend on a request id stored as state within the ModuleCard, but ModuleCards most often unrender during the firmware update process, so this state is lost. This causes the toast never to render.

The second issue is that sometimes, given the timing of the polling for attached modules, the module is always attached during the firmware update, thereby causing the module card not to unrender. When this happens, the useEffect hook responsible for making the success toast has conditional logic that is always true after an update, causing the toast to render infinitely.

The solution to is to lift the request id state out of the module card itself and then abstract away the storage/retrieval via a utility hook, which is utilized by all parent components of ModuleCard. Also, the shouldRenderToast logic should be calculated only on the initial render.
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.

None yet

2 participants