-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
From svelte@5.5.2 a lot of reactive_declaration_non_reactive_property
warnings
#14532
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 believe this should work: // svelte.config.js
compileOptions: {
warningFilter: (warning) =>
!['reactive_declaration_non_reactive_property'].includes(warning.code)
} Found an example usage in one of the tests: svelte/packages/svelte/tests/validator/samples/ignore-warning-compiler-option/_config.js Line 4 in c0746e0
docs are kind of skimpy at this point, definitely need more usage examples, but it's mentioned here: https://svelte.dev/docs/svelte/svelte-compiler#ModuleCompileOptions |
I think they should disable warnings for node_modules files by default. |
just for posterity, here's an example for disabling from sveltejs/language-tools#650 (comment) // svelte.config.js
export default {
compileOptions: {
// disable all warnings coming from node_modules and all accessibility warnings
warningFilter: (warning) => !warning.filename?.includes('node_modules') && !warning.code.startsWith('a11y')
}
} |
I'm not sure that warningFilter applies to runtime warnings? |
The reproduction is not a minimum reproduction, but at least it's investigateable, code for the library lives here: https://github.com/rob-balfre/svelte-select/blob/master/src/lib/Select.svelte It's not using runes so this is definitely a bug. |
What can I do to help you? |
If it helps, i'm getting it a lot using the Flowbite tooltip which is a fair bit simpler https://github.com/themesberg/flowbite-svelte/blob/2257cbcda7ed6149ada56d6be024b6d6e9410d1c/src/lib/tooltip/Tooltip.svelte#L22-L28 https://svelte.dev/playground/bdfa59d3c27a4beabc2bfb31aa4bc4c3?version=5.5.2 |
This happens because in some cases new signals are created while labeled statements are run, which itself is fine, but it messes with the detection logic. We would need to specify that certain signals (internal ones, and harmless new ones) are "fine", but I don't know how currently. |
It does not, at least in our app. Not being able to filter out runtime warnings is making the console effectively useless for us at the moment. |
The suggested fix by @Leonidaz doesn't work unfortunately. After the 5.5.2 is unusable. |
…warning fixes #14532 This removes the `reactive_declaration_non_reactive_property` warning altogether. The first version caused many false positives at compile time. The refined runtime version (introduced in #14192) was hoped to fix this, but it turns out we now get loads of false positives at runtime. The ones I've seen essentially revolve around a signal being created while reading or writing (to) something in a reactive statement, but in a matter which is harmless. For example writing to `$$props` or `$$restProps` (like `$: { if ($$restProps.foo) $$restProps.bar = 'x' }`) creates a new signal under the hood, as the props now temporarily can get out of sync, and we need a backing signal for that. For this we call the `prop` function, which in turn creates several deriveds and may also read from user-land signals that were not read previously - in other words, it's not possible to fix the problem by marking all internal signals (which would be a very very tedious undertaking). The potential benefits of this warning are vastly outnumbered by the false positives it causes, so we should just remove it.
Anyone else have examples for how I can remove these overzealous warnings? |
Just wait, they'll likely be gone this week #14663 |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
From svelte@5.5.2 I get a lot (I mean A LOT) of these warnings in browser console:
We are all waiting for svelte-select to upgrade but in the mean time I would like to not have all these warning in the console which also hide the warnings or real errors.
Reproduction
https://svelte.dev/playground/hello-world?version=5.5.2#H4sIAAAAAAAACm3LOwvCMBSG4b8SvqUK1e6xFNzcOxqHmp5CID0JyfFG6X-XesHF9eF9J3A3EjQO5H1Qt5B8r1bUO6F-jRKD85ShjxPkEZduAZTfax_jNl_Jy2LnLtM_t4GFWDI06myTi9IYNmLEjTEkUS15sqKGFEZVvK9NflmxM1xXv4frT1s1hlFC6C7Qki40n-Yna4ZePcsAAAA=
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: