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

False Positive: State referenced in its own scope will not update #2627

Open
abdel-17 opened this issue Dec 12, 2024 · 0 comments
Open

False Positive: State referenced in its own scope will not update #2627

abdel-17 opened this issue Dec 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@abdel-17
Copy link

abdel-17 commented Dec 12, 2024

Describe the bug

In the following example, Svelte gives a false warning for foo.

<script>
	function getFoo() {
		return 0;
	}

	const foo = $derived.by(getFoo);

	// State referenced in its own scope will never update.
	let { bar = foo } = $props();
</script>

Reproduction

https://svelte.dev/playground/hello-world?version=5.11.2#H4sIAAAAAAAAE22NzWrDMBCEX2VZerDBpD07P9BL6TtUPdjWugiUXSGN0wbjdw9KaE89DfPxDbOyDmfhnt8lRqNvy9FTIz5AfMsdzyFK4f5jZVxT9Srg7nf1mtKuXCSisnEo8h-fTCGKwj0fypRDwsmpw7zohGBKX4I3s6altWKHLFiy0su-1s1pjcm0gGYzOtKTlxwu4nfjtXls2_3DigJaHcYh0_Eub1VP2VJpqnN4_vvnjiE_4B55ke1zuwHbNXYeCQEAAA==

Expected behaviour

It should not warn.

System Info

Irrelevant

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@abdel-17 abdel-17 added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant