material-ui
material-ui copied to clipboard
fix: properly filter palettes
- [x] I have followed (at least) the PR section of the contributing guide.
If there is a palette with a main non-string field, it crashes
Hi @CGNonofr, thanks for the report.
What value are you providing to the main field? It should be a string, it's types as such: https://github.com/mui/material-ui/blob/next/packages/mui-material/src/styles/createPalette.d.ts#L44
Hi @CGNonofr, thanks for the report.
What value are you providing to the
mainfield? It should be a string, it's types as such: https://github.com/mui/material-ui/blob/next/packages/mui-material/src/styles/createPalette.d.ts#L44
PaletteColorOptions is only used for the primary, secondary, error, warning, info and success.
The problem is it is looping of every palettes keys, not only those corresponding to a PaletteColorOptions.
This is not a problem for other predefined fields because none has a main property, but we added a custom palette field with a main field of type object.
This is not a problem for other predefined fields because none has a main property, but we added a custom palette field with a main field of type object.
I see, @siriwatknp what do you think about this use case?
This is not a problem for other predefined fields because none has a main property, but we added a custom palette field with a main field of type object.
I see, @siriwatknp what do you think about this use case?
I think it's okay to apply this change, the performance should not be different from the existing condition. But I think it should apply to all components.
@siriwatknp the logic on the filter is getting more complex, should we extract a utility for it so it can be shared throughout the components?
Also, should we include this in the v6 milestone?
@siriwatknp the logic on the filter is getting more complex, should we extract a utility for it so it can be shared throughout the components?
Also, should we include this in the v6 milestone?
Yes, please. I think it's a good addition but not a blocker for beta.