Skip to content

Commit

Permalink
Back out formatting change to test
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Sep 12, 2022
1 parent ca9921d commit 29f273b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions packages/react-router/__tests__/useRoutes-test.tsx
Expand Up @@ -56,10 +56,7 @@ describe("useRoutes", () => {
it("Uses the `location` prop instead of context location`", () => {
let routes = [
{ path: "one", element: <h1>one</h1> },
{
path: "two",
element: <h1>two</h1>,
},
{ path: "two", element: <h1>two</h1> },
];

let renderer: TestRenderer.ReactTestRenderer;
Expand Down
7 changes: 4 additions & 3 deletions packages/react-router/lib/hooks.tsx
Expand Up @@ -441,9 +441,9 @@ export function useRoutes(
dataRouterStateContext || undefined
);

// When a user passes in a `locationArg` prop, the associated routes need to
// be wrapped in a `LocationContext.Provider` in order for `useLocation` to
// use the `locationArg` location instead of the global location.
// When a user passes in a `locationArg`, the associated routes need to
// be wrapped in a new `LocationContext.Provider` in order for `useLocation`
// to use the scoped location instead of the global location.
if (locationArg) {
return (
<LocationContext.Provider
Expand All @@ -463,6 +463,7 @@ export function useRoutes(
</LocationContext.Provider>
);
}

return renderedMatches;
}

Expand Down

0 comments on commit 29f273b

Please sign in to comment.