-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
False positive ownership_invalid_binding? #15210
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
The problem is that ownership is not widened correctly - it does not know about the previous owners because it's a class which is not traversed. For proxies we have logic in place for this, for classes we need something similar. |
@dummdidumm So what would be the recommendation here? If we know the warning is due to it being class just ignore? Or do you recommend not using classes at all? I think I'm encountering a similar issue to this where I'm using a context which has a class as value. When child components get that context and mutate a property on the class I get the warning. |
This warning is confusing and useless. see here: |
@dummdidumm |
Previously we were doing stack-based retrieval of the owner, which while catching more cases was costly (performance-wise) and prone to errors (as shown by many issues over the months). This drastically simplifies the ownership validation - we now only do simple static analysis to check which props are mutated and wrap them with runtime checks to see if a binding was established. Besides making the implementation simpler and more performant, this also follows an insight we had over the months: Most people don't really know what to do with this warning when it's shown beyond very simple cases. Either it's not actionable because they don't really know how to fix it or they question if they should at all (in some cases rightfully so). Now that the warning is only shown in simple and easy-to-reason-about cases, it has a much better signal-to-noise-ratio and will hopefully guide people in the right direction early on (learn from the obvious cases to not write spaghetti code in more complex cases). closes #15532 closes #15210 closes #14893 closes #13607 closes #13139 closes #11861
Describe the bug
I've encountered the ownership_invalid_binding warning while working on a Svelte 5 project.
Reading the documentation was not helpful in fixing this issue.
Can you help me?
Reproduction
REPL
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: