-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react/v8): Support lazy-loaded routes and components (#15281)
Backports #15039 to v8 branch Potentially fixes as it also fixes cross-usage of `createBrowserRouter` and `useRoutes`: #15279
- Loading branch information
1 parent
c785829
commit 6e996e0
Showing
7 changed files
with
205 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...2e-tests/test-applications/react-create-browser-router/src/pages/LazyLoadedInnerRoute.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as Sentry from '@sentry/react'; | ||
// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX | ||
import * as React from 'react'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
|
||
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes); | ||
|
||
const InnerRoute = () => ( | ||
<SentryRoutes> | ||
<Route path=":innerId" element={<p id="content">I am a lazy loaded user</p>} /> | ||
</SentryRoutes> | ||
); | ||
|
||
export default InnerRoute; |
23 changes: 23 additions & 0 deletions
23
...ages/e2e-tests/test-applications/react-create-browser-router/src/pages/LazyLoadedUser.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as Sentry from '@sentry/react'; | ||
import * as React from 'react'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
|
||
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes); | ||
const InnerRoute = React.lazy(() => import('./LazyLoadedInnerRoute')); | ||
|
||
const LazyLoadedUser = () => { | ||
return ( | ||
<SentryRoutes> | ||
<Route | ||
path=":id/*" | ||
element={ | ||
<React.Suspense fallback={<p>Loading...</p>}> | ||
<InnerRoute /> | ||
</React.Suspense> | ||
} | ||
/> | ||
</SentryRoutes> | ||
); | ||
}; | ||
|
||
export default LazyLoadedUser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters