Skip to content
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: disallow $state/$derived in const tags #15115

Merged
merged 1 commit into from
Jan 27, 2025
Merged

fix: disallow $state/$derived in const tags #15115

merged 1 commit into from
Jan 27, 2025

Conversation

Rich-Harris
Copy link
Member

alternative to #15044. closes #15042

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
Contributor

Playground

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

@paoloricciuti
Copy link
Member

This doesn't cover the $state or $props case right?

I think we should just special case $state.snapshot in #15044

@Rich-Harris
Copy link
Member Author

Rich-Harris commented Jan 27, 2025

$props() is already accounted for, and state is handled with the same logic as derived

@paoloricciuti
Copy link
Member

$props() is already accounted for, and state is handled with the same logic as derived

Oh gotcha...well I guess is better then...close mine

@Rich-Harris Rich-Harris merged commit 0e0f01e into main Jan 27, 2025
10 checks passed
@Rich-Harris Rich-Harris deleted the gh-15042 branch January 27, 2025 13:13
@github-actions github-actions bot mentioned this pull request Jan 27, 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.

$derived and $derived.by in {@const} tags results in obscure error message
2 participants