Skip to content

Using literal when spreading props generates invalid code #3185

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

Closed
Conduitry opened this issue Jul 5, 2019 · 1 comment · Fixed by #3380
Closed

Using literal when spreading props generates invalid code #3185

Conduitry opened this issue Jul 5, 2019 · 1 comment · Fixed by #3380
Labels

Comments

@Conduitry
Copy link
Member

<Foo {...{ bar: 42 }}/>

generates

			var foo_changes = () ? get_spread_update(foo_spread_levels, [
				{ bar: 42 }
			]) : {};

because { bar: 42 } has no dependencies.

@Conduitry Conduitry added the bug label Jul 5, 2019
@Conduitry
Copy link
Member Author

var ${name_changes} = ${all_dependencies.size === 1 ? `${conditions}` : `(${conditions})`} ? @get_spread_update(${levels}, [

I'd assume we should be generating var ${name_changes} = {}; when all_dependencies is empty.

Conduitry added a commit to Conduitry/sveltejs_svelte that referenced this issue Aug 8, 2019
Conduitry added a commit to Conduitry/sveltejs_svelte that referenced this issue Aug 8, 2019
Rich-Harris added a commit that referenced this issue Aug 11, 2019
generate valid code when spreading literal into props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant