Open vultix opened 1 year ago
This is probably a table-browser-auto-inserts-thead/tbody hydration mismatch thing. Probably the only way to fix this is to check and error in dev mode before the html string is sent over the wire.
@dummdidumm I've managed to get the same error, this time using only <div>
elements. The error seems to be due to nesting the elements.
I have a similar problem. I have an SEO component that writes something to
I have the same errors with Svelte 5.0.0-next.1 in Sveltekit,
Similar behavior with mode-watcher
.
It injects some Script into the head, which is likely the reason.
An issue exists, which has been closed "as there is supposed to be backward compatibility".
this bug was cause by the following, which made no sense. even stranger: i couldn't reproduce locally, just on remote. even after trying with pnpm run preview
or node -- build/index.js
import Envelope from 'phosphor-svelte/lib/Envelope'
<Envelope
class="ml-1 inline-block transition-transform duration-100"
color="currentColor"
size={24}
weight="bold"
/>
Uncaught (in promise) DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.
at ce (https://example.com/_app/immutable/chunks/disclose-version.v0n8y_Ea.js:1:1818)
at c1 (https://example.com/_app/immutable/chunks/Envelope.CLt6H9m5.js:1:2710)
at La (https://example.com/_app/immutable/nodes/2.CwgW25T4.js:1:5551)
at Ca (https://example.com/_app/immutable/nodes/2.CwgW25T4.js:1:6479)
at Qa (https://example.com/_app/immutable/nodes/2.CwgW25T4.js:1:8219)
at https://example.com/_app/immutable/entry/app.D8G6VLKe.js:26:28991
at https://example.com/_app/immutable/chunks/svelte-component.euRejRrp.js:1:520
at Sn (https://example.com/_app/immutable/chunks/runtime.CmubDmvt.js:1:6170)
at j (https://example.com/_app/immutable/chunks/runtime.CmubDmvt.js:1:7216)
at R (https://example.com/_app/immutable/chunks/runtime.CmubDmvt.js:1:2307)
i got this issue when using sveltekit2 and svelte5 for video tag The weird thing is that this issue happens even tho I don't use snippets
Various bugs related to hydration have been fixed over the past few months/weeks. Specifically the mentioned nested component divs and head issues should be resolved. What's still not working is recovering from auto-inserted elements (like omitting the tbody
tag in a table).
From those who have contributed to this thread - can you please check if your issues still occur with the latest version, and if so, provide a reproduction (via Stackblitz for example)?
I just tested the original reproduction with the newest versions and get the following errors:
Firefox: Uncaught (in promise) DOMException: Node.appendChild: Cannot add children to a Text
Chrome: Uncaught (in promise) DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.
which could be possibly related to: https://github.com/sveltejs/svelte/issues/12422
Reproduction: https://stackblitz.com/edit/sveltejs-kit-template-default-6zahg7?file=package.json
I still got the bug on dev mode. Production mode is fine.
@Coronon your issue is related to the HTML being invalid, in the sense that the browser needs to repair the DOM, which means the DOM structure is different to what Svelte expects while hydrating, resulting in that error. If you change your Table.svelte
file like this:
+ <table>
+ <tbody>
+ <tr>
<slot />
+ </tr>
+ </tbody>
+ </table>
it will work.
@ryoppippi please provide a reproduction (or point to an existing one which you refer to)
@dummdidumm I try to create a minimal reproduction later, but I'm facing this error with this repo https://github.com/ryoppippi/sveltweet so
git clone https://github.com/ryoppippi/sveltweet
pnpm i
pnpm dev
Then go to http://localhost:5173/examples and refresh the page
I just encountered the issue while toying around with slot snippets in a table. The error message should probably contain a bit more detail as to what caused it.
Describe the bug
When using a sveltekit project with the new svelte 5 preview, I'm getting a hydration error when trying to pass child elements. This error occurs both when using
<slot/>
and{@render children()}
.This only seems to occur if a few conditions hold:
td
,tr
,th
,tbody
,tr
,thead
and you render the child elements in a#each
block<Div><Div>hi</Div></Div>
)Reproduction
Here's a stackblitz reproduction of the problem: https://stackblitz.com/edit/sveltejs-kit-template-default-xzcrsi?description=The%20default%20SvelteKit%20template,%20generated%20with%20create-svelte&file=package.json,src%2Froutes%2FTable.svelte,src%2Froutes%2F%2Bpage.svelte,src%2Fapp.d.ts&title=SvelteKit%20Default%20Template
After opening the stackblitz link, open devtools and note the error message.
Basic reproduction steps:
<slot/>
or{@render children()}
#each
block, rendering any table element (td
,tr
, etc)I have another reproduction using the nested element approach here: https://stackblitz.com/edit/sveltejs-kit-template-default-8bn5tx?description=The%20default%20SvelteKit%20template,%20generated%20with%20create-svelte&file=package.json,src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2FDiv.svelte&title=SvelteKit%20Default%20Template
Logs
System Info
Severity
blocking an upgrade
Additional Information
No response