mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 18:35:10 +02:00
wrongful looping
This commit is contained in:
parent
75d94a1846
commit
548d475ddd
@ -27,6 +27,10 @@ function Router() {
|
|||||||
|
|
||||||
log( 'Address change' )
|
log( 'Address change' )
|
||||||
|
|
||||||
|
if( timer ) {
|
||||||
|
log( `cancelling old timer ${ timer }, address: ${ !!address }` )
|
||||||
|
clearTimeout( timer )
|
||||||
|
}
|
||||||
if( !address ) {
|
if( !address ) {
|
||||||
log( 'No address, setting timer for navigation' )
|
log( 'No address, setting timer for navigation' )
|
||||||
const timeoutNumber = setTimeout( f => {
|
const timeoutNumber = setTimeout( f => {
|
||||||
@ -34,9 +38,6 @@ function Router() {
|
|||||||
navigate( '/' )
|
navigate( '/' )
|
||||||
}, 1000 )
|
}, 1000 )
|
||||||
setTimer( timeoutNumber )
|
setTimer( timeoutNumber )
|
||||||
} else {
|
|
||||||
log( 'Address found, cancelling timer' )
|
|
||||||
if( timer ) clearTimeout( timer )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [ address, navigate, timer ] )
|
}, [ address, navigate, timer ] )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user