router icon indicating copy to clipboard operation
router copied to clipboard

Issue with `useBlocker` when navigating to route with `beforeLoad` and `redirect`

Open PapopCtck opened this issue 1 year ago • 0 comments

Describe the bug

There is an issue when using useBlocker when the user tries to navigate to route with beforeLoad with redirect. The user will either see Blocker twice or have the tab unresponding depending on the type of Blocker used.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-2j52rq?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

Native blocker

  1. Go to Editor 1 page
  2. Type anything into the input
  3. uncheck Use custom blocker
  4. Try to navigate to Editor 2 page
  5. Click ok when the blocker appears

Blocker will appear twice in this case

Custom blocker

  1. Go to Editor 1 page
  2. Type anything into the input
  3. check Use custom blocker
  4. Try to navigate to Editor 2 page
  5. Click yes when the blocker appears

the browser will crash in this case

Expected behavior

As a user, the Blocker should only appear once and not crash the browser

Screenshots or Videos

No response

Platform

  • OS: Windows 11
  • Browser: Arc Browser
  • Version: 1.3.2

Additional context

No response

PapopCtck avatar May 31 '24 10:05 PapopCtck