Conversation
🦋 Changeset detectedLatest commit: 994583c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
This turned out to be a bit of a rabbit hole — we're not currently handling I think that stuff is basically fixed though there's still some stuff I want to look at tomorrow:
Once all that's done, we can get to work on the coordinated updates stuff |
|
Okay, done — hydration works with async blocks, async attributes are now supported outside a |
packages/svelte/src/compiler/phases/3-transform/server/visitors/SvelteElement.js
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/component.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/utils.js
Show resolved
Hide resolved
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
overall looks great
We missed a crucial detail in #16784 — content after an async block isn't correctly hydrated, because the hydration state gets corrupted.
Conceptually the fix is very straightforward. We need to wrap each async block in hydration markers (
<!--[-->and<!--]-->), and when encountering an async block, stash thehydrate_node, skip ahead to the<!--]-->, hydrate the next thing, and then restorehydrate_nodewhen the async block is ready to proceed. I'd like to do a bit more testing before marking this ready for review though.This isn't a complete fix, because hydration will update the DOM piecemeal. That means that if you have something like this...
{#if await condition} <p>hello from the {browser ? 'browser' : 'server'}</p> {/if} <p>hello again from the {browser ? 'browser' : 'server'}</p>...the second paragraph will update immediately, while the second one will update once
conditionresolves. That's not what we want — we want those updates to be synchronized within a boundary. That will involve a little bit more footwork that's outside the scope of this PR, but which we'll get to soon.Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint