Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add startViewTransition support #10916

Merged
merged 43 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0d5dd29
POC support for startViewTransition
brophdawg11 Mar 9, 2023
069b77f
Add example using startViwTransition
brophdawg11 Jul 14, 2023
9d6f330
Update dep
brophdawg11 Aug 22, 2023
cbd6aad
Update approach and add future flags
brophdawg11 Aug 29, 2023
b774db3
Rename future flag
brophdawg11 Aug 29, 2023
dbac4b1
Updates
brophdawg11 Aug 30, 2023
560a894
Switch to useViewTransition hook
brophdawg11 Sep 19, 2023
d4087e9
Add more updates - proxy through Link
brophdawg11 Sep 20, 2023
c383e8f
Add unstable prefix
brophdawg11 Sep 20, 2023
48303d0
Revert "Add unstable prefix"
brophdawg11 Sep 20, 2023
449d51e
Remove viewTransition API from router.navigate
brophdawg11 Sep 20, 2023
c1dee37
Rename useViewTransitions
brophdawg11 Sep 20, 2023
f516ded
Allow return false
brophdawg11 Sep 20, 2023
f800892
POC
brophdawg11 Sep 22, 2023
adf0b78
Get POP navigations working
brophdawg11 Sep 25, 2023
d8bafcd
Lift viewTransition function execution up to router
brophdawg11 Sep 25, 2023
18cc33b
Handle forward pops
brophdawg11 Sep 25, 2023
27f65c1
Updates
brophdawg11 Sep 26, 2023
9fcf8df
Update approch to use prop and hook together
brophdawg11 Sep 28, 2023
7d6a724
Remove currentLocation from ViewTransitionContext
brophdawg11 Sep 28, 2023
5768b76
Fix image freeze on detail->home
brophdawg11 Sep 28, 2023
e43453e
Remove defer value param
brophdawg11 Sep 28, 2023
f456698
Remove usage of fallbackOnDeferRevalidation
brophdawg11 Sep 28, 2023
2359232
Remove fallbackOnDeferRevalidation flag
brophdawg11 Sep 28, 2023
360206f
Remove debug logs
brophdawg11 Sep 28, 2023
15961e1
Clean ups
brophdawg11 Sep 28, 2023
2f716d3
Revert "Remove debug logs"
brophdawg11 Sep 28, 2023
dda9693
Add interruption handling
brophdawg11 Sep 29, 2023
7263d4a
Remove debug logs
brophdawg11 Sep 29, 2023
098efb7
Remove unused flushSync
brophdawg11 Sep 29, 2023
b9f0c8a
Persist applied transitions to sessionStorage
brophdawg11 Sep 29, 2023
3912731
Add docs
brophdawg11 Oct 2, 2023
4a8a492
Handle basename and PUSH navs that reverse a transition
brophdawg11 Oct 4, 2023
7383054
Udpate docs with example
brophdawg11 Oct 4, 2023
d5e1a89
Udpate docs with example
brophdawg11 Oct 4, 2023
35c4680
Add changeset
brophdawg11 Oct 4, 2023
1e8dcaa
Only leverage useViewTransitionState in DataRouter NavLink usages
brophdawg11 Oct 5, 2023
6ddc868
Fix tests
brophdawg11 Oct 11, 2023
04857aa
Unit tests
brophdawg11 Oct 11, 2023
e687cac
Bump bundle
brophdawg11 Oct 11, 2023
34ace81
Bump bundle
brophdawg11 Oct 11, 2023
54298be
Update changeset
brophdawg11 Oct 11, 2023
f3db06f
Rename viewTransitionOpts -> unstable_viewTransitionOpts
brophdawg11 Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename viewTransitionOpts -> unstable_viewTransitionOpts
  • Loading branch information
brophdawg11 committed Oct 11, 2023
commit f3db06f803e1219c977a07602aeb8f73b1a4c786
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