-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Fixes destructuring signal with await bug #9962
Conversation
🦋 Changeset detectedLatest commit: 3ab71cf 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 |
@ngtr6788 is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
752204a
to
51c3e87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you briefly explain why there are multiple test cases for this? Can't they be handled in one test case?
Apart from that, I think this is the most sensible solution, can't think of other good approaches. One thing we possibly could do as a performance optimization is to traverse upwards to the closest function boundary first and check whether or not it's async. Not sure if the additional code is worth the possibly tiny savings we get from it.
packages/svelte/tests/runtime-runes/samples/destructure-assign-async-array-default/main.svelte
Outdated
Show resolved
Hide resolved
packages/svelte/tests/runtime-runes/samples/destructure-assign-async-array/main.svelte
Outdated
Show resolved
Hide resolved
packages/svelte/tests/runtime-runes/samples/destructure-assign-async-object-default/main.svelte
Outdated
Show resolved
Hide resolved
packages/svelte/tests/runtime-runes/samples/destructure-assign-async-object/main.svelte
Outdated
Show resolved
Hide resolved
Come to think of it now, you're right. I can just put it in one test case
Can you elaborate on what you mean by "closest function boundary"? I didn't quite get it :( |
function x() { // the closest function boundary; no async modifier -> can't have await inside expression
let { .. } = { .. }; // the expression we're checking
} |
a9363e5
to
caf3d72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #9686 and #9312 and #9982. Because I can't find a place to determine if an expression is asynchronous, and I can't find a builder for async/await, I ended up building it. Hopefully it's good enough, but comments and feedback and advice is most certainly welcome, because I could be wrong :)
Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.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