summaryrefslogtreecommitdiff
path: root/packages/integrations/svelte
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2022-05-31 11:29:36 -0500
committerGravatar GitHub <noreply@github.com> 2022-05-31 11:29:36 -0500
commite9a77d861907adccfa75811f9aaa555f186d78f8 (patch)
tree1c77ae43165a7f529ea5762811798c3873f1776c /packages/integrations/svelte
parent40614597ccef567afab31621834037b0a77ed317 (diff)
downloadastro-e9a77d861907adccfa75811f9aaa555f186d78f8.tar.gz
astro-e9a77d861907adccfa75811f9aaa555f186d78f8.tar.zst
astro-e9a77d861907adccfa75811f9aaa555f186d78f8.zip
Improve nested and `client:only` hydration (#3455)
* wip: fix nested islands * fix: improve hydration for dynamic content * chore: fix bundle-size script for new files * chore: allow-list client:* directive files * fix(#3362): fix client:only behavior for React, Vue, Solid * test: add client-only e2e test * chore: update lockfile * test: fix e2e tests * test: add framework nesting e2e tests * Update packages/astro/src/runtime/client/events.ts Co-authored-by: Matthew Phillips <matthew@skypack.dev> * chore: add changeset * fix(preact): ignore hydrate roots * chore: remove `ssr` check in integrations * Revert "chore: remove `ssr` check in integrations" This reverts commit ba27eaae5514701f4b7bb6259f682fe82821a23d. * chore: add changeset Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'packages/integrations/svelte')
-rw-r--r--packages/integrations/svelte/client.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js
index c10c7afa0..3f401b544 100644
--- a/packages/integrations/svelte/client.js
+++ b/packages/integrations/svelte/client.js
@@ -1,13 +1,14 @@
import SvelteWrapper from './Wrapper.svelte';
export default (target) => {
- return (component, props, children) => {
+ return (component, props, children, { client }) => {
+ if (!target.hasAttribute('ssr')) return;
delete props['class'];
try {
new SvelteWrapper({
target,
props: { __astro_component: component, __astro_children: children, ...props },
- hydrate: true,
+ hydrate: client !== 'only',
});
} catch (e) {}
};