-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: remove readonly validation #10378
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
Conversation
The readonly dev time validation results in false-negative object equality checks: The original object is proxified and thus comparisons could be between the unproxified and proxified version, which will always return false. Fixes #10372 There's also the problem that an object could be passed into a component but then passed upwards into shared state. At that point, it should no longer be readonly, but it's not possible to statically analyze these points. Fixes #10372 Lastly, the each block logic mutates an internal array and that also throws errors with the readonly logic. Fixes #10037
🦋 Changeset detectedLatest commit: 643e4eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I'd love to try and find a solution that isn't just removing The equality thing is trickier, but I'd still like to try and find an alternative. Like, just spitballing — what if at dev time (where |
But how can we know where objects that have gotten the let { prop } = $props();
// ..
prop.foo = true;
// turns into
$.check_mutation(prop, prop => prop.foo = true) where |
We don't, we just transform every |
Feels like a deal breaker tbh. I'd rather have some false negatives with the validation compared to super hard to detect bugs that may happen at some point. |
Listing the options I see currently: Remove
|
There is another option, not covered above: Provide an
|
closing in favour of #10464 |
The readonly dev time validation results in false-negative object equality checks: The original object is proxified and thus comparisons could be between the unproxified and proxified version, which will always return false. Fixes #10372
There's also the problem that an object could be passed into a component but then passed upwards into shared state. At that point, it should no longer be readonly, but it's not possible to statically analyze these points. Fixes #10372
Lastly, the each block logic mutates an internal array and that also throws errors with the readonly logic. Fixes #10037 (update: was fixed by #10422 already)
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint