-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top-level raw {@html}
hydrated incorrectly
#4542
Comments
I have a fix in #4444 |
Hm. In my actual app, #4444 doesn't seem to fix the issue. And when I enable the test I mentioned above, it's still failing with the duplicated HTML. |
hmm.. okay, can provide a repro that i can take a look? |
I've created a repo that shows this and something else I noticed while putting together the repro. Take a look at the Git history as well, not just the latest HEAD. |
Okay, I see what's the issue here right now. We need to differentiate whether the Component is a root component or not. For example:
The first Given the same logic, However, if But for the case of So, an expected behavior, is that, after the claim, it should remove the rest of the children that was not claimed. |
To determine whether it is a root component or not, we rely on |
This has been fixed in 3.20.0. |
Describe the bug
Components containing a raw
{@html}
tag at the top level are hydrated incorrectly - the existing HTML is not removed.Logs
None.
To Reproduce
Attempt to hydrate a component containing a top-level
{@html}
tag against some existing HTML.Expected behavior
The existing HTML should be replaced, but it is not.
Stacktraces
None
Information about your Svelte project:
Severity
Inconvenient. For my case, I can wrap it in another element without affecting much.
Additional context
There appears to be a disabled and outdated test for this here. If I enable it and add the required
export let raw;
prop declaration to the component, the test fails with the same thing I'm seeing in practice - that there are two copies of the HTML upon hydration.I'm also not entirely certain the problem I'm asking to be fixed here is well defined. How can we know how much the
{@html}
should 'consume' during hydration?The text was updated successfully, but these errors were encountered: