material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[system][Stack] Fix displaying of rendering 0 when divider prop is passed

Open sai6855 opened this issue 1 year ago • 1 comments

Before preview: https://mui.com/material-ui/react-stack/#basics

after preview: https://deploy-preview-44126--material-ui.netlify.app/material-ui/react-stack/#basics

Place below code in both preview to see the difference, in after preview 0 is rendered but not in before preview

import * as React from 'react';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';


export default function BasicStack() {
  return (
    <Box sx={{ width: '100%' }}>
      <Stack spacing={2} divider={<div />}>
        <div>Item 1</div>
        {0}
        <div>Item 2</div>
        <div>Item 3</div>
      </Stack>
    </Box>
  );
}

I was going through this issue https://github.com/mui/material-ui/issues/43969 and found logic mentioned here as bit weird as 0 would get skipped by .filter(Boolean)

sai6855 avatar Oct 16 '24 12:10 sai6855

Netlify deploy preview

https://deploy-preview-44126--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+8B(0.00%) 🔺+5B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 🔺+8B(+0.01%) 🔺+5B(+0.02%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by :no_entry_sign: dangerJS against b1558961901ecbc85cf5d5c3c152087448e549c6

mui-bot avatar Oct 16 '24 12:10 mui-bot