-
-
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: Persist styles of persistent client:only components during view …
…transitions in DEV mode (#8840) * Persist styles of persistent client:only components during view transitions * Persist styles of persistent client:only components during view transitions * Persist styles of persistent client:only components during view transitions * reset flag for persistent style shhets before re-calculating * new approach with a clear module loader cache * simplifications * wait for hydration * improve changeset message * improve changeset message * please the linter * additional tests for Svelte and Vue * tidy up * test fixed * test w/o persistence * Update .changeset/purple-dots-refuse.md Co-authored-by: Sarah Rainsberger <[email protected]> --------- Co-authored-by: Sarah Rainsberger <[email protected]>
- Loading branch information
1 parent
740c916
commit 5c888c1
Showing
16 changed files
with
225 additions
and
13 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 | ||
--- | ||
|
||
Fixes styles of `client:only` components not persisting during view transitions in dev mode |
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
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 |
---|---|---|
|
@@ -8,4 +8,6 @@ | |
|
||
.counter-message { | ||
text-align: center; | ||
background-color: lightskyblue; | ||
color:black | ||
} |
1 change: 1 addition & 0 deletions
1
packages/astro/e2e/fixtures/view-transitions/src/components/Island.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
36 changes: 36 additions & 0 deletions
36
packages/astro/e2e/fixtures/view-transitions/src/components/SvelteCounter.svelte
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,36 @@ | ||
<script lang="ts"> | ||
let count = 0; | ||
function add() { | ||
count += 1; | ||
} | ||
function subtract() { | ||
count -= 1; | ||
} | ||
</script> | ||
|
||
<div class="counter"> | ||
<button on:click={subtract}>-</button> | ||
<pre>{count}</pre> | ||
<button on:click={add}>+</button> | ||
</div> | ||
<div class="message"> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.counter { | ||
display: grid; | ||
font-size: 2em; | ||
grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
margin-top: 2em; | ||
place-items: center; | ||
} | ||
.message { | ||
text-align: center; | ||
background-color: maroon; | ||
color: tomato; | ||
} | ||
</style> |
43 changes: 43 additions & 0 deletions
43
packages/astro/e2e/fixtures/view-transitions/src/components/VueCounter.vue
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,43 @@ | ||
<template> | ||
<div class="counter"> | ||
<button @click="subtract()">-</button> | ||
<pre>{{ count }}</pre> | ||
<button @click="add()">+</button> | ||
</div> | ||
<div class="counter-message"> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { ref } from 'vue'; | ||
export default { | ||
setup() { | ||
const count = ref(0); | ||
const add = () => (count.value = count.value + 1); | ||
const subtract = () => (count.value = count.value - 1); | ||
return { | ||
count, | ||
add, | ||
subtract, | ||
}; | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.counter { | ||
display: grid; | ||
font-size: 2em; | ||
grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
margin-top: 2em; | ||
place-items: center; | ||
} | ||
.counter-message { | ||
text-align: center; | ||
background: darkgreen; | ||
color: greenyellow; | ||
} | ||
</style> |
3 changes: 3 additions & 0 deletions
3
packages/astro/e2e/fixtures/view-transitions/src/components/css.js
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,3 @@ | ||
import "./other.postcss"; | ||
export const indirect = "<dummy>"; | ||
|
1 change: 1 addition & 0 deletions
1
packages/astro/e2e/fixtures/view-transitions/src/components/other.postcss
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 @@ | ||
/* not much to see */ |
11 changes: 11 additions & 0 deletions
11
packages/astro/e2e/fixtures/view-transitions/src/pages/client-only-four.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 Island from '../components/Island'; | ||
import VueCounter from '../components/VueCounter.vue'; | ||
import SvelteCounter from '../components/SvelteCounter.svelte'; | ||
--- | ||
<Layout> | ||
<p id="page-four">Page 4</p> | ||
<VueCounter client:only="vue">Vue</VueCounter> | ||
<SvelteCounter client:only="svelte">Svelte</SvelteCounter> | ||
</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
16 changes: 16 additions & 0 deletions
16
packages/astro/e2e/fixtures/view-transitions/src/pages/client-only-three.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,16 @@ | ||
--- | ||
import Layout from '../components/Layout.astro'; | ||
import Island from '../components/Island'; | ||
import VueCounter from '../components/VueCounter.vue'; | ||
import SvelteCounter from '../components/SvelteCounter.svelte'; | ||
--- | ||
<Layout> | ||
<a id="click-four" href="/client-only-four">go to page 4</a> | ||
<div> | ||
<!-- intentional client:load, see /client-only-one for client:only --> | ||
<Island id="one" client:load count={5}>message here</Island> | ||
</div> | ||
<VueCounter client:only="vue">Vue</VueCounter> | ||
<SvelteCounter client:only="svelte">Svelte</SvelteCounter> | ||
<p id="name">client-only-three</p> | ||
</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
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.