Skip to content

fix: don't transform reassigned state in labeled statement in $derived #15725

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

Merged
merged 4 commits into from
Apr 10, 2025

Conversation

paoloricciuti
Copy link
Member

Closes #15719

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

Copy link

changeset-bot bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: 2090823

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

Copy link
Contributor

Playground

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

@Rich-Harris
Copy link
Member

made a couple small drive-by tweaks, mostly relating to the code that was already there:

  • better to coerce types upstream than downstream, so we don't need optional chaining etc
  • in general we should prefer array.every(foo) to !array.some(bar) for the sake of those of us with brains that struggle to parse double negatives — 'every member of this array satisfies this predicate' is less of a tangle than 'it is not the case that one or more members of this array satisfies this predicate'

@Rich-Harris Rich-Harris merged commit 0d233e5 into main Apr 10, 2025
13 checks passed
@Rich-Harris Rich-Harris deleted the labeled-statement-reassign-state branch April 10, 2025 22:17
@github-actions github-actions bot mentioned this pull request Apr 10, 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.

Migrating combination of let and $: leads error: Identifier 'foo' has already been declared
2 participants