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
refactor(app): trigger UpdateAppModal based on state.alerts #6708
Conversation
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.
Went through the test steps and 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.
self review
<a className={styles.sync_link} onClick={props.onClick} disabled> | ||
click here | ||
</a> | ||
<Link href="#" color={C_BLUE} onClick={props.onClick}> |
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.
Note: <a href="#" ...
misbehaves, in that it will trigger react-router routing. I've replaced this with a more semantically correct <button>
in #6715 that is styled like a link
@@ -51,7 +56,9 @@ export function AdvancedSettingsCard(props: Props): React.Node { | |||
const handleChannel = event => | |||
dispatch(Config.updateConfigValue('update.channel', event.target.value)) | |||
|
|||
React.useEffect(props.checkUpdate, [channel]) |
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 logic moved to an epic
@@ -51,7 +56,9 @@ export function AdvancedSettingsCard(props: Props): React.Node { | |||
const handleChannel = event => | |||
dispatch(Config.updateConfigValue('update.channel', event.target.value)) | |||
|
|||
React.useEffect(props.checkUpdate, [channel]) | |||
useMountEffect(() => { | |||
dispatch(checkShellUpdate()) |
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.
Wait actually this whole thing can go away; a sibling component is already doing this. Will address in #6715
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.
🧀
Overview
This PR switches the app update notification from a custom system to the more generic
app/src/alerts
system. This work unblocks #6684, and also means that when the<UpdateAppModal>
pops up, it doesn't shunt you automatically to a different part of the app; it just opens up over whatever page you're already on.Old and busted:
<UpdateAppModal>
is displayed based on navigating to the/more/app/update
routestate.shell.update.available
andstate.shell.update.seen
and return a react-router<Redirect>
if the notification needs to be seen/more/app
page), a react-router<Link>
points to `/more/app/updateNew hotness:
state.shell.update
and if it sees an update become available, it sends aalerts:ALERT_TRIGGERED
action withalertId: 'appUpdateAvailable'
in the payload<Alerts>
component renders an<UpdateAppModal>
component if theappUpdateAvailable
alert is active<UpdateAppModal>
in a<Portal>
Changelog
useSelector
doesn't change and the store never emits a change notification,useSelector
will always return the cached valuestore.getState.mockReturnValue
Review requests
To test this on a dev app, mess with the
version
inapp
andapp-shell
's package.json so the app thinks it's behind 3.21.0. The following logic was touched:Risk assessment
This is an important part of the UI, so medium risk here. Everything looks good in my click around smoke testing, all new components were TDD'd, and I added some tests to existing (testless) components to ensure new functionality around modal display was covered.