File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import path from 'path';
99
1010import { type App , isInstalled } from '../../../../ipc/apps' ;
1111import appCompatibilityWarning from '../../../util/appCompatibilityWarning' ;
12+ import { useLauncherSelector } from '../../../util/hooks' ;
13+ import { isJLinkFinishedInstalling } from '../../jlinkUpdate/jlinkUpdateSlice' ;
1214import { type DisplayedApp , isInProgress } from '../appsSlice' ;
1315
1416const warning = ( altText : string ) => (
@@ -33,12 +35,14 @@ const appBadge = async (app: App) => {
3335const AppIcon : React . FC < { app : DisplayedApp } > = ( { app } ) => {
3436 const [ badge , setBadge ] =
3537 useState < Awaited < ReturnType < typeof appBadge > > > ( null ) ;
38+ const jlinkInstalled = useLauncherSelector ( isJLinkFinishedInstalling ) ;
3639
3740 useEffect ( ( ) => {
3841 if ( ! isInProgress ( app ) ) {
3942 appBadge ( app ) . then ( setBadge ) ;
4043 }
41- } , [ app ] ) ;
44+ // Trigger this once more after JLink was successfully installed or updated
45+ } , [ app , jlinkInstalled ] ) ;
4246
4347 return (
4448 < div className = "core-app-icon" >
Original file line number Diff line number Diff line change @@ -11,11 +11,13 @@ import {
1111 GenericDialog ,
1212} from '@nordicsemiconductor/pc-nrfconnect-shared' ;
1313
14+ import { resetJlinkCompatibilityCache } from '../../util/appCompatibilityWarning' ;
1415import { useLauncherDispatch , useLauncherSelector } from '../../util/hooks' ;
1516import { continueUpdateProcess } from '../process/updateProcess' ;
1617import {
1718 getInstalledJLinkVersion ,
1819 getJLinkUpdateProgress ,
20+ isJLinkFinishedInstalling ,
1921 isJLinkUpdateProgressDialogVisible ,
2022 reset ,
2123} from './jlinkUpdateSlice' ;
@@ -25,8 +27,7 @@ export default () => {
2527 const isJLinkInstalled = ! ! useLauncherSelector ( getInstalledJLinkVersion ) ;
2628 const isVisible = useLauncherSelector ( isJLinkUpdateProgressDialogVisible ) ;
2729 const progress = useLauncherSelector ( getJLinkUpdateProgress ) ;
28- const finished =
29- progress ?. step === 'install' && progress . percentage === 100 ;
30+ const finished = useLauncherSelector ( isJLinkFinishedInstalling ) ;
3031
3132 return (
3233 < GenericDialog
@@ -39,6 +40,7 @@ export default () => {
3940 < DialogButton
4041 onClick = { ( ) => {
4142 dispatch ( reset ( ) ) ;
43+ resetJlinkCompatibilityCache ( ) ;
4244 dispatch ( continueUpdateProcess ( ) ) ;
4345 } }
4446 disabled = { ! finished }
Original file line number Diff line number Diff line change @@ -72,3 +72,6 @@ export const getJLinkVersionToBeInstalled = (state: RootState) =>
7272 state . jlinkUpdate . versionToBeInstalled ;
7373export const getInstalledJLinkVersion = ( state : RootState ) =>
7474 state . jlinkUpdate . installedVersion ;
75+ export const isJLinkFinishedInstalling = ( state : RootState ) =>
76+ state . jlinkUpdate . updateProgress ?. step === 'install' &&
77+ state . jlinkUpdate . updateProgress ?. percentage === 100 ;
Original file line number Diff line number Diff line change @@ -193,6 +193,10 @@ const getJlinkCompatibility = memoize(
193193 } ,
194194) ;
195195
196+ export const resetJlinkCompatibilityCache = ( ) => {
197+ getJlinkCompatibility . cache . clear ?.( ) ;
198+ } ;
199+
196200export const checkJLinkRequirements : AppCompatibilityChecker = async (
197201 app : LaunchableApp ,
198202) => {
You can’t perform that action at this time.
0 commit comments