Skip to content

Commit

Permalink
Rename viewTransitionOpts -> unstable_viewTransitionOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Oct 11, 2023
1 parent 54298be commit f3db06f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/react-router/lib/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export function RouterProvider({
);

let setState = React.useCallback<RouterSubscriber>(
(newState: RouterState, { viewTransitionOpts }) => {
(
newState: RouterState,
{ unstable_viewTransitionOpts: viewTransitionOpts }
) => {
if (
!viewTransitionOpts ||
router.window == null ||
Expand Down
8 changes: 4 additions & 4 deletions packages/router/__tests__/router-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17699,7 +17699,7 @@ describe("a router", () => {
navigation: IDLE_NAVIGATION,
location: expect.objectContaining({ pathname: "/a" }),
}),
{ viewTransitionOpts: undefined }
{ unstable_viewTransitionOpts: undefined }
);

// PUSH /a -> /b - w/ transition
Expand All @@ -17710,7 +17710,7 @@ describe("a router", () => {
location: expect.objectContaining({ pathname: "/b" }),
}),
{
viewTransitionOpts: {
unstable_viewTransitionOpts: {
currentLocation: expect.objectContaining({ pathname: "/a" }),
nextLocation: expect.objectContaining({ pathname: "/b" }),
},
Expand All @@ -17725,7 +17725,7 @@ describe("a router", () => {
location: expect.objectContaining({ pathname: "/a" }),
}),
{
viewTransitionOpts: {
unstable_viewTransitionOpts: {
// Args reversed on POP so same hooks apply
currentLocation: expect.objectContaining({ pathname: "/a" }),
nextLocation: expect.objectContaining({ pathname: "/b" }),
Expand All @@ -17740,7 +17740,7 @@ describe("a router", () => {
navigation: IDLE_NAVIGATION,
location: expect.objectContaining({ pathname: "/" }),
}),
{ viewTransitionOpts: undefined }
{ unstable_viewTransitionOpts: undefined }
);

unsubscribe();
Expand Down
4 changes: 2 additions & 2 deletions packages/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export interface RouterSubscriber {
(
state: RouterState,
opts: {
viewTransitionOpts?: ViewTransitionOpts;
unstable_viewTransitionOpts?: ViewTransitionOpts;
}
): void;
}
Expand Down Expand Up @@ -1015,7 +1015,7 @@ export function createRouter(init: RouterInit): Router {
...newState,
};
subscribers.forEach((subscriber) =>
subscriber(state, { viewTransitionOpts })
subscriber(state, { unstable_viewTransitionOpts: viewTransitionOpts })
);
}

Expand Down

0 comments on commit f3db06f

Please sign in to comment.