-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix: Patch structuredClone
in dev to correctly clone $state
proxies
#14599
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 31511f8 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 |
preview: https://svelte-dev-git-preview-svelte-14599-svelte.vercel.app/ this is an automated message |
Not sure why lint tests are failing, I ran prettier on everything I changed... |
It's erroring because Regardless, this seems like a very bad idea — it will mean that code suddenly breaks in production. If we were to monkey-patch |
Should it throw when attempting to clone a $state proxy instead? |
I mean, it does, the error is just a bit unclear. The easy solution would be to wrap the underlying call to The more complete solution would basically be to reimplement |
Would this also clone state proxies, or would it throw an error if attempted? |
It would throw an error. The behaviour would need to be identical to |
@Rich-Harris I've added the more complete option (not completely finished yet) and the basic option. Most of the concerns I have are in the comments in |
Should close #13562. Currently a draft due to lack of tests and other concerns about implementation.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint