material-components/material-components-web-react

Chip does not behave as controlled component

lambduli opened this issue · 5 comments

Hello everyone,

If Chipset is provided with selectedChipIds Array and user clicks on selected chip it loses its checkmark even though it is specified inside the Array and Chip iself has selected set.
I figured Chipset holds this array and modifies it as its state even though it probably should be only taking props from higher context.

Is there a way to prevent said behaviour? Unfortunately my component is functional component and I cannot simply re-render it - so it is kinda out of the question.

Thank you very much.

@taskkill Thanks for opening the issue - we are aware of this issue as we've had it open since the Spring. I'm going to close this as we are already tracking this.

Thanks!

#785

@moog16 Thanks but my issue was question: Is there a way around it?
I' ve definitely seen that issue. But it does not propose some mean-time fix or workaround.

@taskkill Not without a code change, sorry. I would suggest using RMWC in the meantime. JamesFriedman has done a great job at implementing material design and up holding React best practices. RMWC actually uses MDC Web's foundation/adapter just like MDC React does, so it will always be up to spec.

@moog16 Thank you for giving me that information. Appreciate it.

no problem! LMK if you have any other questions.