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

Fix TabbedShowLayout resolves path incorrectly if first tab is null #5312

Merged
merged 3 commits into from
Oct 1, 2020

Conversation

WiXSL
Copy link
Contributor

@WiXSL WiXSL commented Sep 28, 2020

Fixes #5294

packages/ra-ui-materialui/src/detail/TabbedShowLayout.js Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/detail/TabbedShowLayout.js Outdated Show resolved Hide resolved

<Divider />
<div className={classes.content}>
{Children.map(children, (tab, index) =>
tab && isValidElement(tab) ? (
{Children.map(finalChildren, (tab, index) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, you can use the regular children, right? This avoids having a different value at each render, and defeating pure component optimizations.

Copy link
Contributor Author

@WiXSL WiXSL Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, if I go back to using Children.map(children, (tab, index) => the tests won't pass.
Should I filter nonNullChildren with useMemo?

@fzaninotto fzaninotto merged commit e87de36 into marmelab:next Oct 1, 2020
@fzaninotto
Copy link
Member

Thanks!

@fzaninotto fzaninotto added this to the 3.9.0 milestone Oct 1, 2020
@WiXSL WiXSL deleted the fix-optional-first-tab branch October 1, 2020 10:49
@fzaninotto fzaninotto modified the milestones: 3.9.0, 3.9.2 Oct 5, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants