-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transitions router): no-op on the server (#8771)
* fix(transitions router): no-op on the server * factor out onPopState * add e2e test case * Apply suggestions from code review Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * use supportsViewTransitions * add changeset * warn on navigate() use during ssr * switch supportsViewTransitions to import.meta.env * correct typo * bring back import.meta.env * !import.meta.env.SSR -> inBrowser * Apply suggestions from code review Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> --------- Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixed an issue where the transitions router did not work within framework components. |
5 changes: 5 additions & 0 deletions
5
packages/astro/e2e/fixtures/view-transitions/src/components/ClickToNavigate.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
import { navigate } from "astro:transitions/client"; | ||
export default function ClickToNavigate({ to, id }) { | ||
return <button id={id} onClick={() => navigate(to)}>Navigate to `{to}`</button>; | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/astro/e2e/fixtures/view-transitions/src/pages/client-load.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import ClickToNavigate from "../components/ClickToNavigate.jsx" | ||
import { ViewTransitions } from "astro:transitions"; | ||
--- | ||
<html> | ||
<head> | ||
<ViewTransitions /> | ||
</head> | ||
<body> | ||
<ClickToNavigate id="react-client-load-navigate-button" to="/two" client:load/> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters