Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

You cannot call prepareStyles() on the same style object more than once #128

Closed
BrandKNY opened this issue Jul 22, 2017 · 2 comments
Closed

Comments

@BrandKNY
Copy link

This issue appears to have been recently closed out (reference issue #123). I am still seeing this issue myself using Material-ui v0.18.6.

Specifically I am rendering a set of Chip components which use the 'onRequestDelete' function prop. Furthermore I attempted to use the 'deleteIconStyle' prop which was causing an error "Warning: Unknown prop 'deleteIconStyle' on

tag. Remove this prop from the element." referenced by #7417 and subsequently closed by #7407. Since I was using Material v 0.18.1 at the time I pulled that fix in by updating to v 0.18.6, where I am now receiving the error related to prepareStyles on the Chip element.

The error fires on renders and even fires repeatedly as the mouse-over crosses any part of the Chip component.

To be clear none of my supplied props are changing upon mouse-over events; The IDs are used for accessing components via Ref from a parent in certain scenarios where it might be necessary, and the 'deleteIconStyle' is a hard-coded object constant at the top of the class file. The 'variable' itself is quite simply a string which is not changing. Internally the parent class is holding an array of objects in its own state where each object is of an enumerated type which determines whether it will be rendered as a Chip or a TextField, however once the object is determined to be a Chip its associated data remains unchanged. The only way to change that data would be to trigger the Chip's onTouchTap which will transform the object in the parent's state into a different type which will render it as an entirely different TextField component (where it can then again be 'saved' and transformed into a new Chip Component once again).

render() {
    const { id, variable, chipStyle, chipColor, labelColor, labelStyle } = this.props;
    const chipID = getVariableChipID(id);
    return (
      <Chip
        id={chipID}
        key={chipID}
        ref={chipID}
        style={chipStyle}
        onTouchTap={this.onTouchTap}
        onRequestDelete={this.onRequestDelete}
        deleteIconStyle={chipDeleteIconStyle}
        backgroundColor={chipColor}
        labelColor={labelColor}
        labelStyle={labelStyle}
      >
        {variable}
      </Chip>
    );
  }
@leMaik
Copy link
Member

leMaik commented Jul 22, 2017

My PR was merged 11 days ago, whereas v0.18.6 was released 17 days ago, please be patient until they push out a new release. ⏳

The warning is not caused by the chip input but by the chips.

@BrandKNY
Copy link
Author

@leMaik My bad, it's early I must've crossed the dates in my head after looking at them and thought your PR was issued before the push to 0.18.6

Thanks for the rapid reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants