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

Regression in 1.47.0 with empty default slots #1007

Closed
ekhaled opened this issue Dec 11, 2017 · 3 comments · Fixed by #1017
Closed

Regression in 1.47.0 with empty default slots #1007

ekhaled opened this issue Dec 11, 2017 · 3 comments · Fixed by #1017
Labels

Comments

@ekhaled
Copy link
Contributor

ekhaled commented Dec 11, 2017

This REPL fails with Cannot read property 'default' of undefined

but works in <= v1.46.0

The following ways of adding components in v1.47.0 work:

<Person :data :foo :bar />
<Person :data :foo :bar ></Person>

The following ways fail:

<Person :data :foo :bar >
</Person
<Person 
  :data 
  :foo 
  :bar
>
</Person>
@Conduitry
Copy link
Member

It looks like there are a couple things going on here.

  • Trying to send a default slot into a component that isn't set up to use it (by containing <slot/> somewhere in its definition) will result in that runtime error. This is also present in 1.46.0
  • Whitespace-only content is treated as no content for the default slot in 1.46.0 but is treated as something to try to stick into the default slot in 1.46.1.

I'm not sure which of these is the best to address. Fixing the second one would restore 1.46.0 behavior. Is fixing the first one more desirable? Or might that be considered hiding an error, and we actually want an exception to be thrown in that case?

@Conduitry Conduitry added the bug label Dec 11, 2017
@ekhaled
Copy link
Contributor Author

ekhaled commented Dec 11, 2017

IMO if you send slot content into a component that does not have a <slot /> it should not throw an exception, maybe a dev warning

@Rich-Harris
Copy link
Member

Fixed in 1.47.2, thanks. Opened a separate issue about slots in non-slottable components — #1020

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.

3 participants