Skip to content

Regression: svelte:component with spread props loses static props #9177

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
PatrickG opened this issue Sep 5, 2023 · 5 comments
Closed

Regression: svelte:component with spread props loses static props #9177

PatrickG opened this issue Sep 5, 2023 · 5 comments

Comments

@PatrickG
Copy link
Member

PatrickG commented Sep 5, 2023

Describe the bug

It looks like #9006 introduced a bug.
When changing this and a spread props object, static props are not passed to the new component.
Also, it seems like the old spread props are passed to the new component first and then get changed to the new spread props.

Reproduction

https://svelte.dev/repl/c967016570194f1e90a1226132377e61?version=4.1.1
When clicking "page1" or "page2", it always should log "toto", instead undefined and "<Page2> was created without expected prop 'test'" is logged.

Also "<Page2> was created with unknown prop 'page1Prop'" is logged, which indicates the old spread props are passed to the new component.

REPL is working on version 4.1.0: https://svelte.dev/repl/c967016570194f1e90a1226132377e61?version=4.1.0

Logs

No response

System Info

REPL with Svelte 4.1.1

Severity

blocking an upgrade

@marianmeres
Copy link

I confirm similar strange behaviour on 4.2.0. I would classify it as a quite major bug.

REPL: https://svelte.dev/repl/1136dab3b7d642b7a429974c881057ae?version=4.2.0 (somewhat similar to above)

TL;DR: the two lines below behave differently

// doesn't work
<svelte:component this={component} {...props} {foo} />
// works
<svelte:component this={component} {...{...props, foo}} />

@BearToCode
Copy link

For your interest this works fine on the Svelte v5 Preview REPL.

@MrWaip
Copy link

MrWaip commented Dec 8, 2023

I also faced the same problem.

Svelte version 4.2.8

@MrWaip
Copy link

MrWaip commented Dec 12, 2023

Any update here? It's critical bug. Any dynamic forms are broken

BearToCode added a commit to BearToCode/mismerge that referenced this issue Feb 16, 2024
Apply a fix, but the bug is due to: sveltejs/svelte#9177
@dummdidumm
Copy link
Member

Fixed in Svelte 5

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

No branches or pull requests

5 participants