Add experimental support for the View Transitions API via document.startViewTransition to enable CSS animated transitions on SPA navigations in your application. (#10916)
The simplest approach to enabling a View Transition in your React Router app is via the new <Link unstable_viewTransition> prop. This will cause the navigation DOM update to be wrapped in document.startViewTransition which will enable transitions for the DOM update. Without any additional CSS styles, you'll get a basic cross-fade animation for your page.
If you need to apply more fine-grained styles for your animations, you can leverage the unstable_useViewTransitionState hook which will tell you when a transition is in progress and you can use that to apply classes or styles:
You can also use the <NavLink unstable_viewTransition> shorthand which will manage the hook usage for you and automatically add a transitioning class to the <a> during the transition:
Please note, that because the ViewTransition API is a DOM API, we now export a specific RouterProvider from react-router-dom with this functionality. If you are importing RouterProvider from react-router, then it will not support view transitions. (#10928
Patch Changes
Log a warning and fail gracefully in ScrollRestoration when sessionStorage is unavailable (#10848)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.16.0 to 6.17.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/remix-run/react-router/releases">react-router-dom's releases</a>.</em></p>
<blockquote>
<h2>react-router-dom-v5-compat@6.4.0-pre.15</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li>react-router@6.4.0-pre.15</li>
<li>react-router-dom@6.4.0-pre.15</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.11</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li>react-router@6.4.0-pre.11</li>
<li>react-router-dom@6.4.0-pre.11</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.10</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li>react-router@6.4.0-pre.10</li>
<li>react-router-dom@6.4.0-pre.10</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.9</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li>react-router@6.4.0-pre.9</li>
<li>react-router-dom@6.4.0-pre.9</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.8</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li>react-router@6.4.0-pre.8</li>
<li>react-router-dom@6.4.0-pre.8</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.7</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies
<ul>
<li><code>react-router@6.4.0-pre.7</code></li>
<li><code>react-router-dom@6.4.0-pre.7</code></li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.6</h2>
<h3>Patch Changes</h3>
<ul>
<li>44bce3c6: Fix <code>react-router-dom</code> peer dependency version
<ul>
<li>react-router@6.4.0-pre.6</li>
<li>react-router-dom@6.4.0-pre.6</li>
</ul>
</li>
</ul>
<h2>react-router-dom-v5-compat@6.4.0-pre.5</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md">react-router-dom's changelog</a>.</em></p>
<blockquote>
<h2>6.17.0</h2>
<h3>Minor Changes</h3>
<ul>
<li>
<p>Add experimental support for the <a href="https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition">View Transitions API</a> via <code>document.startViewTransition</code> to enable CSS animated transitions on SPA navigations in your application. (<a href="https://redirect.github.com/remix-run/react-router/pull/10916">#10916</a>)</p>
<p>The simplest approach to enabling a View Transition in your React Router app is via the new <code><Link unstable_viewTransition></code> prop. This will cause the navigation DOM update to be wrapped in <code>document.startViewTransition</code> which will enable transitions for the DOM update. Without any additional CSS styles, you'll get a basic cross-fade animation for your page.</p>
<p>If you need to apply more fine-grained styles for your animations, you can leverage the <code>unstable_useViewTransitionState</code> hook which will tell you when a transition is in progress and you can use that to apply classes or styles:</p>
<pre lang="jsx"><code>function ImageLink(to, src, alt) {
let isTransitioning = unstable_useViewTransitionState(to);
return (
<Link to={to} unstable_viewTransition>
<img
src={src}
alt={alt}
style={{
viewTransitionName: isTransitioning ? "image-expand" : "",
}}
/>
</Link>
);
}
</code></pre>
<p>You can also use the <code><NavLink unstable_viewTransition></code> shorthand which will manage the hook usage for you and automatically add a <code>transitioning</code> class to the <code><a></code> during the transition:</p>
<pre lang="css"><code>a.transitioning img {
view-transition-name: "image-expand";
}
</code></pre>
<pre lang="jsx"><code><NavLink to={to} unstable_viewTransition>
<img src={src} alt={alt} />
</NavLink>
</code></pre>
<p>For an example usage of View Transitions with React Router, check out <a href="https://github.com/brophdawg11/react-router-records">our fork</a> of the <a href="https://github.com/Charca/astro-records">Astro Records</a> demo.</p>
<p>For more information on using the View Transitions API, please refer to the <a href="https://developer.chrome.com/docs/web-platform/view-transitions/">Smooth and simple transitions with the View Transitions API</a> guide from the Google Chrome team.</p>
<p>Please note, that because the <code>ViewTransition</code> API is a DOM API, we now export a specific <code>RouterProvider</code> from <code>react-router-dom</code> with this functionality. If you are importing <code>RouterProvider</code> from <code>react-router</code>, then it will not support view transitions. (<a href="https://redirect.github.com/remix-run/react-router/pull/10928">#10928</a></p>
</li>
</ul>
<h3>Patch Changes</h3>
<ul>
<li>Log a warning and fail gracefully in <code>ScrollRestoration</code> when <code>sessionStorage</code> is unavailable (<a href="https://redirect.github.com/remix-run/react-router/pull/10848">#10848</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/remix-run/react-router/commit/edd9ad4957321cfb260cee21ad98aab2becfe250"><code>edd9ad4</code></a> chore: Update version for release (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10935">#10935</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/6cfbd0e571018bf1d8722c09d70e394d2602f5be"><code>6cfbd0e</code></a> chore: Update version for release (pre) (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10934">#10934</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/c48341d6b75f4fd5b0ec60ed32c3c45ebb1e532f"><code>c48341d</code></a> Lift startViewTransition implementation to react-router-dom (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10928">#10928</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/b916689b4a211827cc324cf05994c334e25d380b"><code>b916689</code></a> chore: Update version for release (pre) (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10931">#10931</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/b09c5d09198b1ee4a8bfbf8a2a8910fc8eed7d2c"><code>b09c5d0</code></a> chore: Update version for release (pre) (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10924">#10924</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/feebfc0bf10614ba44ff43e2b9c69e22ad07a7a1"><code>feebfc0</code></a> Add startViewTransition support (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10916">#10916</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/da57748644da6400e2d051b2aa004df47beda1cf"><code>da57748</code></a> fix(docs): add backticks to element names (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10874">#10874</a>)</li>
<li><a href="https://github.com/remix-run/react-router/commit/f8194fdb8e371b715d29d30a82e04a82a7648e9b"><code>f8194fd</code></a> Handle case when session storage is blocked (<a href="https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom/issues/10848">#10848</a>)</li>
<li>See full diff in <a href="https://github.com/remix-run/react-router/commits/react-router-dom@6.17.0/packages/react-router-dom">compare view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bumps react-router-dom from 6.16.0 to 6.17.0.
Release notes
Sourced from react-router-dom's releases.
... (truncated)
Changelog
Sourced from react-router-dom's changelog.
... (truncated)
Commits
edd9ad4chore: Update version for release (#10935)6cfbd0echore: Update version for release (pre) (#10934)c48341dLift startViewTransition implementation to react-router-dom (#10928)b916689chore: Update version for release (pre) (#10931)b09c5d0chore: Update version for release (pre) (#10924)feebfc0Add startViewTransition support (#10916)da57748fix(docs): add backticks to element names (#10874)f8194fdHandle case when session storage is blocked (#10848)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Deploying with
Cloudflare Pages
0a8bd95View logs