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

Passing content (slot/children) to a component without slot breaks #1447

Closed
kaisermann opened this issue May 11, 2018 · 2 comments · Fixed by #4501
Closed

Passing content (slot/children) to a component without slot breaks #1447

kaisermann opened this issue May 11, 2018 · 2 comments · Fixed by #4501

Comments

@kaisermann
Copy link
Member

REPL

The following component throws a Cannot read property 'default' of undefined:

App.html

<Test>Hmmm</Test>

<script>
	export default {
		components: {
			Test: './test.html'
		}
	}
</script>

Test.html

<div>
	I don't have a slot
</div>
@Rich-Harris
Copy link
Member

Ah, yep. I think this should probably throw a more helpful error in dev mode:

<Test> cannot have children as it does not have a <slot> element

With that change, the current prod mode behaviour is probably acceptable?

I wonder if there's a smart way to construct a stack so that when you click the trace, it points to the correct line in the source code.

@EmilTholin
Copy link
Member

This doesn't throw an error anymore. Maybe there should be a warning along the lines of <Test> does not have a <slot> element?

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

Successfully merging a pull request may close this issue.

4 participants