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

Setting $state with NaN causes updates #14545

Closed
trueadm opened this issue Dec 4, 2024 · 1 comment
Closed

Setting $state with NaN causes updates #14545

trueadm opened this issue Dec 4, 2024 · 1 comment
Labels

Comments

@trueadm
Copy link
Contributor

trueadm commented Dec 4, 2024

Describe the problem

When setting state with NaN it causes an update even though NaN is the same value as before.

<script>
	let x = $state(NaN);
</script>

<button onclick={() => {
	x = NaN
}}>Set NaN</button>

{#key x}
	<iframe title="Svelte" src="https://svelte.dev"></iframe>
{/key}

Playground

Describe the proposed solution

Svelte should either switch to using Object.is for default equality or it should provide a way of supplying a custom equals function.

Importance

would make my life easier

@trueadm trueadm added the bug label Dec 4, 2024
@dummdidumm
Copy link
Member

Closing as duplicate of #10061

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants