reach / router

Home Page:https://reach.tech/router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirect with noThrow fails when loaded repeatedly in a short time

ManishaA08 opened this issue · comments

Description:
Please consider that:
Home is a Link to path = "/"
Redirect redirects the page to "/home/door" when the link = "/"
When Redirect with noThrow is invoked several times for eg by clicking on a Link component "HOME" repeatedly, at times during DOM reconciliation the Redirect component is not unmounted, but the URL has changed to reflect that of the Link ("/"). Since Redirect with noThrow works by navigating to the redirect path on componentDidMount further clicks on Home will not redirect.

Reproduction: https://codesandbox.io/s/reach-router-with-nothrow-fails-on-repeated-clicks-osqt8

Steps:

  1. Open the codesandbox
  2. Click on Home several times

NOTE: This issue is not consistently reproducible.

Workaround:

  1. Unmount Redirect by navigating to some other path
  2. Remove noThrow