-
-
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 SolidJS view transition state persistence (#11998)
* Fix SolidJS view transition state persistence * Add changeset --------- Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
- Loading branch information
1 parent
b75bfc8
commit 082f450
Showing
9 changed files
with
127 additions
and
28 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 @@ | ||
--- | ||
'@astrojs/solid-js': patch | ||
--- | ||
|
||
Fix view transition state persistence |
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
19 changes: 19 additions & 0 deletions
19
packages/astro/e2e/fixtures/view-transitions/src/components/solid/Counter.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,19 @@ | ||
import {createSignal} from "solid-js"; | ||
|
||
export default function Counter(props) { | ||
const [count, setCount] = createSignal(0); | ||
const add = () => setCount(count() + 1); | ||
const subtract = () => setCount(count() - 1); | ||
|
||
return ( | ||
<> | ||
<div class="counter"> | ||
<button onClick={subtract} class="decrement">-</button> | ||
|
||
<pre>{props.prefix ?? ''}{count()}{props.postfix ?? ""}</pre> | ||
<button onClick={add} class="increment">+</button> | ||
</div> | ||
<div class="counter-message">{props.children}</div> | ||
</> | ||
); | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/astro/e2e/fixtures/view-transitions/src/pages/island-solid-one.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,11 @@ | ||
--- | ||
import Layout from '../components/Layout.astro'; | ||
import Counter from '../components/solid/Counter.jsx'; | ||
export const prerender = false; | ||
--- | ||
<Layout> | ||
<p id="island-one">Page 1</p> | ||
<a id="click-two" href="/island-solid-two">go to 2</a> | ||
<Counter prefix="A" client:load transition:persist transition:name="counter" /> | ||
</Layout> |
11 changes: 11 additions & 0 deletions
11
packages/astro/e2e/fixtures/view-transitions/src/pages/island-solid-two.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,11 @@ | ||
--- | ||
import Layout from '../components/Layout.astro'; | ||
import Counter from '../components/solid/Counter.jsx'; | ||
export const prerender = false; | ||
--- | ||
<Layout> | ||
<p id="island-two">Page 2</p> | ||
<a id="click-one" href="/island-solid-one">go to 1</a> | ||
<Counter prefix="B" postfix="!" client:load transition:persist transition:name="counter" /> | ||
</Layout> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.