-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
Description
What you were expecting:
RA lazy strategy with loading should work properly after update to react-router v7.
What happened instead:
Loading component not initiate in Suspense when update my App to react-router v7.
Steps to reproduce:
- Create router that import lazy components;
- Navigate with slow network to understand the problem, setted in the Browser;
- Loading componente will not be initiated by RA Suspense;
This strategy solved my problem:
remix-run/react-router#12474
I think that we can put key inside the Suspense to solve the problem:
<Suspense fallback={<Loading />}> |
like:
function MyComp() {
const location = useLocation()
return (
<Suspense
fallback={<LoadingComp text="Loading..." />}
key={location.key}
>
<MyAwaitOrUseComp />
</Suspense>
)
}
Other information:
Environment
- React-admin version: 5.8.4
- Last version that did not exhibit the issue (if applicable):
- React version: v18
- Browser: chrome
- Stack trace (in case of a JS error):