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

Using slots on svelte:element is buggy in v.3.48.0 #7571

Closed
MathiasWP opened this issue May 30, 2022 · 3 comments
Closed

Using slots on svelte:element is buggy in v.3.48.0 #7571

MathiasWP opened this issue May 30, 2022 · 3 comments
Labels

Comments

@MathiasWP
Copy link
Contributor

MathiasWP commented May 30, 2022

Describe the bug

Setting a slot prop on the svelte:element tag makes it behave in a broken way.

I'm not sure if the case I encountered is the only case where behaviour is buggy.

See the REPL for more info, but this is what made me find the bug:

  1. Have a dynamic class on the svelte:element tag
  2. Pass down a slot prop in the svelte:element tag
  3. Update the value of the slot prop
  4. The dynamic class is now gone (even though it had nothing to do with the slot pop)

Reproduction

https://svelte.dev/repl/af99dfa4e9ef45f6bce713e90af2de38?version=3.48.0

Logs

No response

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 48.09 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.1.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 101.1.38.119
    Chrome: 102.0.5005.61
    Edge: 101.0.1210.53
    Firefox: 100.0
    Safari: 14.1.1
  npmPackages:
    svelte: ^3.47.0 => 3.47.0

Severity

blocking an upgrade

@MathiasWP
Copy link
Contributor Author

Note: This bug was introduced in version 3.48.0, it does not occur in 3.47.0: https://svelte.dev/repl/af99dfa4e9ef45f6bce713e90af2de38?version=3.47.0

@MathiasWP MathiasWP changed the title Using slot props on svelte:element is buggy Using slot props on svelte:element is buggy in v.3.48.0 May 30, 2022
@dummdidumm dummdidumm added the bug label May 30, 2022
@schibrikov
Copy link

schibrikov commented Jun 1, 2022

It seems to be the case even without slot props. I have Text component which looks roughly like this:

<svelte:element
	this={tag}
	class="text"
	class:bold
	class:color-basic={color === 'basic'}
	class:color-accent={color === 'accent'}
	class:color-invert={color === 'invert'}
	class:color-muted={color === 'muted'}
	class:color-invalid={color === 'invalid'}
	class:size-s={size === 's'}
	class:size-m={size === 'm'}
	class:size-l={size === 'l'}
	class:size-xl={size === 'xl'}
	class:size-header={size === 'header'}
	class:block
	class:breakWord
>
	<slot />
</svelte:element>

and it seems to remove dynamic classes when slot content is changed.
Thanks to this issue I was able to workaround the issue by sticking to 3.47.

@MathiasWP MathiasWP changed the title Using slot props on svelte:element is buggy in v.3.48.0 Using slots on svelte:element is buggy in v.3.48.0 Jun 3, 2022
@baseballyama
Copy link
Member

This is already fixed by #7531
Still this is not released but you can check this out when next version is released.

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

4 participants