Skip to content

When SSR output starts with a comment, hydration fails #12532

Closed
@buhrmi

Description

@buhrmi

Describe the bug

Since next.179, when the SSR output starts with a comment (for example because the root block is an if-block, resulting in <!--[--> as the first node in the SSR output), hydration fails. Does not happen in next.178

Reproduction

Here is a minimal reproduction in the REPL: https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA31Q0WrDMAz8Fc17aAxJ856lYWMfMGgem0JDonRmjWNsZaMY__vsuF0LhT0YofPpdDrLBnFCw4qdZbIdkRXsTSmWMjqr0JhvPBH63kyz7gJSmk4LRVUjGxKjmjSBhU5jS7htf2oplEJK4fPcaw-Bg0FPI6yi0Orlbux9GtXld52HZn1PCq-bpCEY2i-s6y1sHtYkCYdNBYldBkij7FEXENFDBBsqn7Jsl2VV0PiYSc0LsvdIZBzSWA3SrBJq9RGJg72OXy5JgsPU3xoJ4HgkuFAc5950md-ykfY12rnaT7jzMY5TLwaBPStIz-jSv9SD-n-x22cxwDLTSLhd4vfkYvDYo_be_QLjIk6A3QEAAA==

I've done some digging, and it seems that in next.178 the append is called, which is no-op during hydration. In next.179, the child function is called, which tries to append a node to the comment node.

next.178:
image

next.179:
image

Logs

No response

System Info

N/A

Severity

blocking an upgrade

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions