-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Hydration crashes in if branch for undefined data #15819
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
Comments
I was looking few solutions and seems that just returning from the function in case the data is undefined fixes the issue.
I can do a PR but I am afraid I do not have the full understanding of the consequences this has. Anyways happy to help if possible as this is causing lot of headache for us in production at the moment. edit: The "fixes the issue" is maybe bit of overstatement - the application does not crash but it removes the content that got injected by an extension. Ideally that would be left alone. |
Seeing this in Chrome 135.0.7049.115 too |
I experience this error on Firefox137.0.1 and Chromium 135.0.7049.84, so I don't think it's a browser specific issue. |
From what I can tell it is not browser specific. What I meant about Safari WebView in the initial report was that this does not only occur with extensions injecting things into DOM - also browsers do that in some cases. |
Thanks, kkarikos! |
Can anyone create a simple reproduction of this issue? By 'simple' I mean a component plus some malformed HTML, not a browser extension — it needs to be something that can go into our test suite |
closed via #15851 |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Hydration can crash at
svelte/packages/svelte/src/internal/client/dom/blocks/if.js
Line 65 in 018996c
When browser extension (or browser itself in some cases*) modifies the DOM content before the hydration executes, the value of
data
can become undefined. The result is that the whole page disappears which is unacceptable. Adding a check for undefined here fixes the issue but I am not certain what would be the desired value in this case.*Safari WebView for example can detect some content as being telephone number and will modify it to become a link.
Reproduction
I created simple browser extension to modify #results of my application.
// manifest.json
// content.js
Logs
System Info
Binaries: Node: 20.17.0 npm: 11.2.0 pnpm: 9.11.0 Browsers: Brave Browser: 135.1.77.100 Chrome: 135.0.7049.95 npmPackages: svelte: 5.28.2 => 5.28.
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: