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

Spreads props does not work on <svelte:window /> #10314

Open
minht11 opened this issue Jan 26, 2024 · 2 comments
Open

Spreads props does not work on <svelte:window /> #10314

minht11 opened this issue Jan 26, 2024 · 2 comments
Milestone

Comments

@minht11
Copy link

minht11 commented Jan 26, 2024

Describe the bug

<script>
	let count = $state(0);

	function increment() {
		count += 1;
	}

	const listeners = {
		onclick: increment,
	}
</script>

<svelte:window {...listeners} />

clicks: {count}

When running code above, window click handler should be set, instead nothing happens.

In fact no code is generated at all so this either work or should be marked as an error.

Reproduction

Reproduction

Logs

No response

System Info

"svelte": "5.0.0-next.40",

Severity

annoyance

@dummdidumm
Copy link
Member

dummdidumm commented Jan 29, 2024

I think it should throw a validation error, and so should class:, let:, in:, out:, transition:, animate:

Technically it's a breaking change (someone could have that in Svelte 4 where it doesn't error but also doesn't do anything), so after sleeping on it, in the interest of full backwards compatibility, I'm not that sure anymore.

At the very least, spread props didn't work in Svelte 4 either, so this isn't a bug. Giving this the 5.0 milestone in the sense of "we need to decide what to do with this before 5.0, in case we want to go the throw validation errors route".

@dummdidumm dummdidumm added this to the 5.0 milestone Jan 30, 2024
@dummdidumm
Copy link
Member

We don't want to go the throw route, therefore moving to 5.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants