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

Props on components' children come in on `props.children[0].props.children.props`, not on `props.children[0].props` #84

Closed
valentijnnieman opened this issue Sep 26, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@valentijnnieman
Copy link
Contributor

commented Sep 26, 2018

One thing that I found weird when writing the Tabs component, is that the props on children components coming from Dash are not available on props.children[0].props(for example, where props.children[0] is a Tab component for instance), but on props.children[0].props.children.props. I've went around this by having some logic saying "if child.props.children exists, the props are coming from Dash, otherwise they're coming from Demo.js", but that causes weirdness when, in JS (Demo.js or perhaps a unit test), you set children on a <Tab/>, causing the logic to pick that up as "oh, these are coming from Dash" and using the child.props.children.props which is then not the props we want!

Hope this makes sense!

@T4rk1n

This comment has been minimized.

Copy link
Contributor

commented Sep 26, 2018

I found that weird too, it's the TreeContainer render function that does this.

@chriddyp

This comment has been minimized.

Copy link
Member

commented Sep 26, 2018

Right, that's because we wrap each component in a NotifyObservers component. Until tabs was written, we didn't have any components that needed to introspect their children

@valentijnnieman valentijnnieman self-assigned this Sep 26, 2018

@valentijnnieman

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2018

Ah cool thanks. Let me see if I can come up with a fix!

@chriddyp

This comment has been minimized.

Copy link
Member

commented Apr 21, 2019

This is now available as props._dashprivate_layout

@chriddyp chriddyp closed this Apr 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.