Skip to content

Commit c69c7de

Browse files
ellieloksarah11918
andauthored
Remove deprecated ViewTransitions component (#14400)
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
1 parent 6f78172 commit c69c7de

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

.changeset/rich-horses-begin.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'astro': major
3+
---
4+
5+
Removes the deprecated `<ViewTransitions />` component
6+
7+
In Astro 5.0, the `<ViewTransitions />` component was renamed to `<ClientRouter />` to clarify the role of the component. The new name makes it more clear that the features you get from Astro's `<ClientRouter />` routing component are slightly different from the native CSS-based MPA router. However, a deprecated version of the `<ViewTransitions />` component still existed and may have functioned in Astro 5.x.
8+
9+
Astro 6.0 removes the `<ViewTransitions />` component entirely and it can no longer be used in your project. Update to the `<ClientRouter />` component to continue to use these features.
10+
11+
#### What should I do?
12+
13+
Replace all occurrences of the `ViewTransitions` import and component with `ClientRouter`:
14+
15+
```diff
16+
// src/layouts/MyLayout.astro"
17+
- import { ViewTransitions } from 'astro:transitions';
18+
+ import { ClientRouter } from 'astro:transitions';
19+
<html>
20+
<head>
21+
...
22+
- <ViewTransitions />
23+
+ <ClientRouter />
24+
</head>
25+
</html>
26+
```

packages/astro/client.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ declare module 'astro:transitions' {
122122
export const createAnimationScope: TransitionModule['createAnimationScope'];
123123

124124
type ClientRouterModule = typeof import('./components/ClientRouter.astro');
125-
/**
126-
* @deprecated The ViewTransitions component has been renamed to ClientRouter
127-
*/
128-
export const ViewTransitions: ClientRouterModule['default'];
129125
export const ClientRouter: ClientRouterModule['default'];
130126
}
131127

packages/astro/src/transitions/vite-plugin-transitions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ export default function astroTransitions({ settings }: { settings: AstroSettings
3030
return {
3131
code: `
3232
export * from "astro/virtual-modules/transitions.js";
33-
export {
34-
default as ViewTransitions,
35-
default as ClientRouter
36-
} from "astro/components/ClientRouter.astro";
33+
export { default as ClientRouter } from "astro/components/ClientRouter.astro";
3734
`,
3835
};
3936
}

0 commit comments

Comments
 (0)