You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a child element returns null (conditionally), the Stack still treats this as a child and inserts a divider, even though there is no DOM element to divide:
Expected behavior
I would have expected that null children would not be treated as DOM elements and not produce any dividers.
Context
I have an action/navigation bar with several sections. Under some conditions, some of those sections don't make any sense, and so the components that render them return null in that case. I don't want the dividers to show up around invisible sections.
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
Note
@githorse How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
Steps to reproduce
Stackblitz example
Current behavior
When a child element returns
null
(conditionally), theStack
still treats this as a child and inserts a divider, even though there is no DOM element to divide:Expected behavior
I would have expected that null children would not be treated as DOM elements and not produce any dividers.
Context
I have an action/navigation bar with several sections. Under some conditions, some of those sections don't make any sense, and so the components that render them return
null
in that case. I don't want the dividers to show up around invisible sections.Your environment
npx @mui/envinfo
Search keywords: stack divider child children null
The text was updated successfully, but these errors were encountered: