@@ -78,7 +78,6 @@ export const Account = ({
7878 const [ usesProxy , setUsesProxy ] = useState < boolean > ( ) ;
7979 const [ insured , setInsured ] = useState < boolean > ( false ) ;
8080 const [ uncoveredFunds , setUncoveredFunds ] = useState < string [ ] > ( [ ] ) ;
81- const [ stateCode , setStateCode ] = useState < string > ( ) ;
8281 const [ detailID , setDetailID ] = useState < accountApi . ITransaction [ 'internalID' ] | null > ( null ) ;
8382 const supportedExchanges = useLoad < SupportedExchanges > ( getExchangeSupported ( code ) , [ code ] ) ;
8483
@@ -217,7 +216,6 @@ export const Account = ({
217216 } ;
218217
219218 useEffect ( ( ) => {
220- setStateCode ( code ) ;
221219 setBalance ( undefined ) ;
222220 setStatus ( undefined ) ;
223221 setSyncedAddressesCount ( 0 ) ;
@@ -227,24 +225,19 @@ export const Account = ({
227225
228226 const hasDataLoaded = balance !== undefined && transactions !== undefined ;
229227
230- if ( stateCode !== code ) {
231- // Sync code property with stateCode to work around a re-render that
232- // happens briefly before `setStatus(undefined)` stops rendering again below.
233- return null ;
234- }
235- if ( ! account || status === undefined ) {
228+ if ( ! account ) {
236229 return null ;
237230 }
238231
239- if ( status . fatalError ) {
232+ if ( status ? .fatalError ) {
240233 return (
241234 < Spinner text = { t ( 'account.fatalError' ) } />
242235 ) ;
243236 }
244237
245238 // Status: offline error
246239 const offlineErrorTextLines : string [ ] = [ ] ;
247- if ( status . offlineError !== null ) {
240+ if ( status !== undefined && status . offlineError !== null ) {
248241 offlineErrorTextLines . push ( t ( 'account.reconnecting' ) ) ;
249242 offlineErrorTextLines . push ( status . offlineError ) ;
250243 if ( usesProxy ) {
@@ -253,7 +246,7 @@ export const Account = ({
253246 }
254247
255248 // Status: not synced
256- const notSyncedText = ( ! status . synced && syncedAddressesCount !== undefined && syncedAddressesCount > 1 ) ? (
249+ const notSyncedText = ( status !== undefined && ! status . synced && syncedAddressesCount !== undefined && syncedAddressesCount > 1 ) ? (
257250 '\n' + t ( 'account.syncedAddressesCount' , {
258251 count : syncedAddressesCount . toString ( ) ,
259252 defaultValue : 0 ,
@@ -291,10 +284,10 @@ export const Account = ({
291284 < Status hidden = { ! hasCard } type = "warning" >
292285 { t ( 'warning.sdcard' ) }
293286 </ Status >
294- < Status className = { style . status } hidden = { ! status . offlineError } type = "error" >
287+ < Status className = { style . status } hidden = { status === undefined || ! status . offlineError } type = "error" >
295288 { offlineErrorTextLines . join ( '\n' ) }
296289 </ Status >
297- < Status className = { style . status } hidden = { status . synced || ! ! status . offlineError } type = "info" >
290+ < Status className = { style . status } hidden = { status === undefined || status . synced || ! ! status . offlineError } type = "info" >
298291 { t ( 'account.initializing' ) }
299292 { notSyncedText }
300293 </ Status >
@@ -319,7 +312,7 @@ export const Account = ({
319312 </ Link >
320313 < HideAmountsButton />
321314 </ Header >
322- { status . synced && hasDataLoaded && isBitcoinBased ( account . coinCode ) && (
315+ { status !== undefined && status . synced && hasDataLoaded && isBitcoinBased ( account . coinCode ) && (
323316 < HeadersSync coinCode = { account . coinCode } />
324317 ) }
325318 < View >
0 commit comments