Skip to content

Conversation

@dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Nov 6, 2025

Correctly takes into account blockers for bindings. Also ensures it works for functional bindings.

During that I also noticed a bug in our nodes_end assignment logic, which the added test also regresses against.

Fixes #17092
Fixes #17090

Also discovered a related bug with static props also not awaiting the blockers, which is also fixed in this PR

Before submitting the PR, please make sure you do the following

  • 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
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Correctly takes into account blockers for bindings. Also ensures it works for functional bindings.

During that I also noticed a bug in our `nodes_end` assignment logic, which the added test also regresses against.

Fixes #17092
Fixes #17090
@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: bf356a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Playground

pnpm add https://pkg.pr.new/svelte@17120

@sillvva
Copy link

sillvva commented Nov 6, 2025

Testing this. This works:

<script lang="ts">
  await Promise.resolve();
	let search = $state("test");
</script>

<input type="text" bind:value={search} />

This does not:
https://svelte.dev/playground/7e4390edddab4574b9fb36eefde2bd7b?version=pr-17120

<script lang="ts">
  await Promise.resolve();
	let search = $state({ query: "test" });
</script>

<!-- works if you remove the binding below or the await above -->
<!-- also works if you move the await after the `$state()` -->
<!-- Cannot read properties of undefined (reading 'query') -->
<input type="text" bind:value={search.query} />

@dummdidumm dummdidumm marked this pull request as ready for review November 6, 2025 15:43
@dummdidumm
Copy link
Member Author

Thank you for the test! Uncovered a dev-only bug with validation (it needed to wait on blockers, too)

@dummdidumm
Copy link
Member Author

Found this was wrong for style directives, too

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so glad you figured all this out so i didn't have to 😆

@Rich-Harris Rich-Harris merged commit 68d4f9c into main Nov 7, 2025
17 of 18 checks passed
@Rich-Harris Rich-Harris deleted the bindings-async-fix branch November 7, 2025 22:40
@github-actions github-actions bot mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Svelte 5.43.0+: Function bindings and await in a single component cause an error await order breaks bind:

4 participants