-
Notifications
You must be signed in to change notification settings - Fork 178
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(app): add generic run paused splash screen #14873
Conversation
let subText: string | null | ||
switch (errorType) { | ||
default: | ||
subText = protocolName ?? null | ||
} |
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.
can't this be simplified to just const subText = protooclName ?? null
?
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.
The intention is we will very shortly add more errorType
s to the list.
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.
question
what is the purpose of using switch here?
in the future displaying something here?
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.
Yep, exactly. See PR description.
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.
Reviving this - would love to see this factored into an independent, pure, exported-for-testability function e.g.
export /* for testability */ function subtext(props: RunPausedSplashProps, /* may require future extra args */): string | null {
switch(...) return (...)
return null
}
export function RunPausedSplash(...): ... {
return (.. <SplashBody>{subtext(props)}</SplashBody>...)
}
This seems minor, but I know that we use the open-coded let+switch in a lot of places and then test everything with rendered-dom inspection later, and in my view it makes the component functions really big and hard to follow. I think the pattern of factoring out functions and testing them as independent units can be nicer.
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/OnDeviceDisplay/RunningProtocol/__tests__/RunPausedSplash.test.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
4479a13
to
4c583ab
Compare
app/src/organisms/OnDeviceDisplay/RunningProtocol/RunPausedSplash.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM!
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.
Have some code-style stuff.
let subText: string | null | ||
switch (errorType) { | ||
default: | ||
subText = protocolName ?? null | ||
} |
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.
Reviving this - would love to see this factored into an independent, pure, exported-for-testability function e.g.
export /* for testability */ function subtext(props: RunPausedSplashProps, /* may require future extra args */): string | null {
switch(...) return (...)
return null
}
export function RunPausedSplash(...): ... {
return (.. <SplashBody>{subtext(props)}</SplashBody>...)
}
This seems minor, but I know that we use the open-coded let+switch in a lot of places and then test everything with rendered-dom inspection later, and in my view it makes the component functions really big and hard to follow. I think the pattern of factoring out functions and testing them as independent units can be nicer.
lastAnimatedCommand={lastAnimatedCommand.current} | ||
updateLastAnimatedCommand={(newCommandKey: string) => | ||
(lastAnimatedCommand.current = newCommandKey) | ||
{enableSplash && |
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 optionality is getting kind of tough to follow. could we
- factor the common parts into a common function
- put the unique parts, I guess with uniqueness defined by the feature flag, in independent functions that don't in and of themselves check the feature flag
- have this component check the feature flag and delegate?
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.
Yeah sounds good!
Can't respond to this in-line for some reason. I agree with you - this isn't a pattern we have used extensively, and I think that's historically because of how React used to work with the stack reconciler, back when I'm guessing we first used React. I think we can make the case pretty easily for it if we pull this out for use in the same file, and I'm fine doing this if the same-file approach works with you. |
Closes EXEC-387
Overview
Add a fallback run paused splash screen that will show when no specific errorType is handled explicitly. The exact logic used to display the splash message will most likely change (and we'll add specific error type subtext later).
Test Plan
curl --location '<robot ip>:31950/settings' \ --header 'opentrons-version: *' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data '{ "id": "enableErrorRecoveryExperiments", "value": true }'
(Please set this to false when you're done testing).edge
is pushed). Verify that the splash screen appears (note that cancelling the run after this point doesn't work currently).Changelog
Risk assessment
low