@@ -58,7 +58,7 @@ const updateCoreInfo = (): AppThunk<RootState> => (dispatch, getState) => {
5858 startAddresses . find (
5959 s =>
6060 s >= networkCore . romBaseAddr &&
61- s <= networkCore . romBaseAddr + networkCore . romSize
61+ s <= networkCore . romBaseAddr + networkCore . romSize ,
6262 )
6363 ) {
6464 dispatch ( setDeviceDefinition ( nRF5340DefaultDevice ) ) ;
@@ -81,7 +81,7 @@ const updateCoreInfo = (): AppThunk<RootState> => (dispatch, getState) => {
8181 romSize : Math . max ( lastEndAddress , 0x100000 ) , // 1 MB
8282 } ,
8383 } ,
84- } )
84+ } ) ,
8585 ) ;
8686 }
8787} ;
@@ -90,9 +90,12 @@ export const removeFile =
9090 ( filePath : string ) : AppThunk < RootState > =>
9191 ( dispatch , getState ) => {
9292 const { loaded, memMaps } = getState ( ) . app . file ;
93- const newLoaded = { ...loaded } ;
93+
94+ const newLoaded = Object . fromEntries (
95+ Object . entries ( loaded ) . filter ( ( [ key ] ) => key !== filePath ) ,
96+ ) ;
97+
9498 const newMemMaps = memMaps . filter ( element => element [ 0 ] !== filePath ) ;
95- delete newLoaded [ filePath ] ;
9699
97100 dispatch ( fileParse ( { loaded : newLoaded , memMaps : newMemMaps } ) ) ;
98101 dispatch ( updateCoreInfo ( ) ) ;
@@ -135,10 +138,12 @@ const parseZipFile =
135138 stat ( filePath , ( statsError , result ) => {
136139 if ( statsError ) {
137140 logger . error (
138- `Could not open ZIP file: ${ describeError ( statsError ) } `
141+ `Could not open ZIP file: ${ describeError ( statsError ) } ` ,
139142 ) ;
140143 dispatch (
141- ErrorDialogActions . showDialog ( describeError ( statsError ) )
144+ ErrorDialogActions . showDialog (
145+ describeError ( statsError ) ,
146+ ) ,
142147 ) ;
143148 removeMruFile ( filePath ) ;
144149 return reject ( ) ;
@@ -163,10 +168,12 @@ const parseHexFile =
163168 stat ( filePath , ( statsError , result ) => {
164169 if ( statsError ) {
165170 logger . error (
166- `Could not open HEX file: ${ describeError ( statsError ) } `
171+ `Could not open HEX file: ${ describeError ( statsError ) } ` ,
167172 ) ;
168173 dispatch (
169- ErrorDialogActions . showDialog ( describeError ( statsError ) )
174+ ErrorDialogActions . showDialog (
175+ describeError ( statsError ) ,
176+ ) ,
170177 ) ;
171178 removeMruFile ( filePath ) ;
172179 return reject ( ) ;
@@ -180,14 +187,14 @@ const parseHexFile =
180187 logger . info ( 'Parsing HEX file: ' , filePath ) ;
181188 logger . info (
182189 'File was last modified at ' ,
183- stats . mtime . toLocaleString ( )
190+ stats . mtime . toLocaleString ( ) ,
184191 ) ;
185192 if ( readError ) {
186193 logger . error (
187- `Could not open HEX file: ${ describeError ( readError ) } `
194+ `Could not open HEX file: ${ describeError ( readError ) } ` ,
188195 ) ;
189196 dispatch (
190- ErrorDialogActions . showDialog ( describeError ( readError ) )
197+ ErrorDialogActions . showDialog ( describeError ( readError ) ) ,
191198 ) ;
192199 removeMruFile ( filePath ) ;
193200 return reject ( ) ;
@@ -268,7 +275,7 @@ export const openFileDialog = (): AppThunk => dispatch => {
268275 . showOpenDialog ( getCurrentWindow ( ) , dialogOptions )
269276 . then (
270277 ( { filePaths } : { filePaths : string [ ] } ) =>
271- filePaths && dispatch ( openFile ( ...filePaths ) )
278+ filePaths && dispatch ( openFile ( ...filePaths ) ) ,
272279 ) ;
273280} ;
274281
@@ -288,11 +295,11 @@ export const refreshAllFiles =
288295 logger . info ( 'Does not need to be reloaded: ' , filePath ) ;
289296 } catch ( error ) {
290297 logger . error (
291- `Could not open HEX file: ${ describeError ( error ) } `
298+ `Could not open HEX file: ${ describeError ( error ) } ` ,
292299 ) ;
293300 dispatch (
294- ErrorDialogActions . showDialog ( describeError ( error ) )
301+ ErrorDialogActions . showDialog ( describeError ( error ) ) ,
295302 ) ;
296303 }
297- } )
304+ } ) ,
298305 ) . then ( ( ) => Promise . resolve ( ) ) ;
0 commit comments