You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Navigation started in useEffect will be completed in a microtask when loaders resolve. If an error is thrown before the navigation was completed, it will result in an infinite loop unless we cancel this microtask.
It makes sense because when you are doing this
useEffect(()=>{router.navigate(...);},[])
You are essentially doing this
useEffect(()=>{// starts navigationupdateState();// router resolves loadersPromise.resolve().then(()=>{// completes navigation in a microtaskupdateState();})},[])
Currently I were able to workaround the infinite loop like this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposed API
Context
Navigation started in useEffect will be completed in a microtask when loaders resolve. If an error is thrown before the navigation was completed, it will result in an infinite loop unless we cancel this microtask.
It makes sense because when you are doing this
You are essentially doing this
Currently I were able to workaround the infinite loop like this
Infinite loop bug reproduction - https://codesandbox.io/p/github/layerok/infinite-loop-react-router/main
Don't worry, your browser won't crush, I've added a check to stop the infinite loop
To get more context, you can read this issue mui/mui-x#13230
I don't want to duplicate all details here.
Beta Was this translation helpful? Give feedback.
All reactions