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 stale failedCommand during Error Recovery #15973

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Aug 12, 2024

Closes RQA-2936

Overview

Recently, we added functionality to "retain" the failed command, so the app has the ability to show certain things even after the server no longer currently recovers from a failed command.

The exact dependency array used to update the retained failed command didn't properly account for the exact command, so sometimes you'd enter error recovery with a stale command the second time you entered error recovery. This fixes that and cleans up some of the memoized labware calculation utilities, which weren't completely correct either.

Test Plan and Hands on Testing

  • Verified correct behavior according to the protocol/steps in the linked ticket.

Changelog

  • Fixed the Error Recovery tip selector not always showing the correct well from which to pick up tips.

Risk assessment

low

@mjhuff mjhuff requested a review from a team as a code owner August 12, 2024 19:54
Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

TY!

Comment on lines -44 to +48
}, [failedCommandByRunRecord?.key, protocolAnalysis?.id])
}, [
failedCommandByRunRecord?.key,
failedCommandByRunRecord?.error?.errorType,
protocolAnalysis?.id,
])
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a React idiom question, I think:

Would it not be safer for the useEffect dependencies to be failedCommandByRunRecord (the object reference) and protocolAnalysis (the object reference)? And then some memoization thing elsewhere ensures that those object references change when, and only when, the object contents change? Is that even possible?

I ask because it seems easy to miss a dependency when we list out specific scalars like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good question. To question #2, It is possible. To question #1, in general, I don't see this done elsewhere, and my guess would be that:

  • It's more code to maintain and reason about.
  • You still have the base problem of thinking about what causes a re-render, and now it exists apart from the useEffect.
  • It's arguably less efficient.
  • ESlint has a react-hooks plugin that gives us a rough idea of what dependencies we should think about adding/exclude. It's not perfect, but it's at least there.

But yes, it's incredibly easy to miss dependencies, and that's why I think a lot of React developers hesitate every time they think about reaching for useEffect.

@mjhuff mjhuff merged commit dfae4cc into chore_release-8.0.0 Aug 12, 2024
26 checks passed
@mjhuff mjhuff deleted the app_fix-stale-failed-command branch August 12, 2024 20:40
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