svelte
svelte copied to clipboard
fix: disable promise callback when {#await} is destroyed
The promise callbacks used on {#await} can resolve after the block has been destroyed, which leads to other errors.
See #13236
A simple solution : set the input to null in order to disable the callbacks.
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 not main.
Before submitting the PR, please make sure you do the following
- [X] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [X] Prefix your PR title with
feat:,fix:,chore:, ordocs:. - [X] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.
Tests and linting
- [X] Run the tests with
pnpm testand lint the project withpnpm lint
⚠️ No Changeset found
Latest commit: 8c02cb6253a31d6232c11f6df29ca9f622e55c48
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Please could you add a test case for this?
P.s. if you need it here's a super minimal reproduction...if you use this in the test you can just check the checkbox, uncheck it and assert that the logs is an empty array (make sure to wait the time of the resolution...to be very sure you can even expose the promise itself to be able to await it in the test)
I added a test under runtime-runes/samples/await-pending-destroy
Not sur if it's the good place. I tried to make it as simple as possible...
Ugh I forgot to add a change set before merging, silly me
This should close the #13236