preact-router icon indicating copy to clipboard operation
preact-router copied to clipboard

The behavior of Router.onChange() is different between 2.6.1 and 3.0.0

Open 38elements opened this issue 6 years ago • 0 comments

The behavior of Router.onChange() is different between 2.6.1 and 3.0.0.

onChange(event) is Router.onChange() in 2.6.1 and Preact 8.4.2. When event.url is /foo, this transfers to bar. But, This does not transfer to bar in 3.0.0 and Preact 10.0.0-alpha.2.

function onChange(event) {
  if (event.url === '/foo') {
    router('/bar')
  }
}

Following code transfers to bar in 3.0.0 and Preact 10.0.0-alpha.2.

function onChange(event) {
  if (event.url === '/foo') {
    setTimeout(() = {
       router('/bar')
    })
  }
}

38elements avatar Mar 29 '19 17:03 38elements