Skip to content

[system] Remove Box clone prop #18496

@numToStr

Description

@numToStr
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

clone prop works perfectly fine in development. But when I saw the production build of the app, there styling is ignored which is applied by <Box clone/> component.

Steps to Reproduce 🕹

// BaseRouterLink
import React, { forwardRef } from "react";
import {
    Link as RouterLink,
    LinkProps as RouterLinkProps
} from "react-router-dom";

export default forwardRef<HTMLAnchorElement, RouterLinkProps>((props, ref) => (
    <RouterLink innerRef={ref} {...props} />
));
// <BackButton />
import React, { FC } from "react";
import IconButton, { IconButtonProps } from "@material-ui/core/IconButton";
import BackIcon from "@material-ui/icons/ArrowBackTwoTone";
import BaseRouterLink from "./Base/BaseRouterLink";
import Box from "@material-ui/core/Box";

type Props = IconButtonProps & {
    to: string;
};

const BackButton: FC<Props> = ({ to }) => {
    return (
        <Box clone mb={2}>
            <IconButton component={BaseRouterLink} color="primary" to={to}>
                <BackIcon fontSize="small" />
            </IconButton>
        </Box>
    );
};

export default BackButton;

I attached some images to clarify the scenario with the above components.

Production Build:

margin-bottom is not applied to the button
production

Development Build:

margin-bottom is applied to the button
development

Your Environment 🌎

Tech Version
Material-UI ^4.6.1
React ^16.12.0
Browser Firefox v70
TypeScript ^3.7.2
etc.

I hope component order is not the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeIntroduces changes that are not backward compatible.component: BoxThe React component.scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions