Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly filter palettes #42698

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CGNonofr
Copy link
Contributor

@CGNonofr CGNonofr commented Jun 20, 2024

If there is a palette with a main non-string field, it crashes

@zannager zannager added the component: slider This is the name of the generic UI component, not the React module! label Jun 21, 2024
@zannager zannager requested a review from DiegoAndai June 21, 2024 14:54
@DiegoAndai
Copy link
Member

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

@CGNonofr
Copy link
Contributor Author

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: slider This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants