Skip to content

Commit

Permalink
Merge pull request #257 from Dias999/feature/Navigation-initial_route…
Browse files Browse the repository at this point in the history
…_adjustments

feat: adjust initial route to prevent redirect on refresh
  • Loading branch information
andreneto97 authored Oct 15, 2024
2 parents 6f095ec + 547febc commit 5540037
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/react-navigation/src/components/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ const Router = ({
{
path: '/',
element: rootElement ? (
React.cloneElement(
rootElement,
{},
<>
<Outlet />
{initialRoute && <Navigate to={initialRoute} replace />}
</>,
)
React.cloneElement(rootElement, {}, <Outlet />)
) : (
<div>
Home test no root
<Outlet />
</div>
<Outlet />
),
children: [
...(initialRoute
? [
{
path: '/',
element: <Navigate to={initialRoute} replace />,
},
]
: []),
{
path: '*',
element: childRoutes,
Expand Down

0 comments on commit 5540037

Please sign in to comment.