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

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. #6135

Closed
AndriiPetrashchukEmpeek opened this issue Apr 8, 2021 · 2 comments · Fixed by #6146
Assignees
Labels

Comments

@AndriiPetrashchukEmpeek
Copy link

AndriiPetrashchukEmpeek commented Apr 8, 2021

I got the error

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.

when I used the "SimpleList" component;

I supposed i got this error because i passed prop "secondaryText"
which pass to the prop "secondary" of ListItemText there we have the condition:
secondary={ hasSecondaryText ? Placeholder : undefined}
ListItemText it's node Element p
component Placeholder return to us div node element

Example

<SimpleList
primaryText={record => record.email}
secondaryText={record => record.roleId}
tertiaryText={record => (record.isActive ? 'Active' : 'Inactive')}
linkType="edit"
/>

Environment

React-admin version: ^3.12.2
React version: ^17.0.1
Browser: Google Chrome

@djhi
Copy link
Collaborator

djhi commented Apr 9, 2021

So make sure your Placeholder component does not return a div

@djhi djhi closed this as completed Apr 9, 2021
@fzaninotto
Copy link
Member

I could reproduce the bug in the simple example by making the dataProvider slower. The problem comes from our <SimpleListLoading> component.

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