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

AutocompleteInput cause material error when I want customize input style #6394

Closed
mohandes-jiri opened this issue Jun 25, 2021 · 7 comments · Fixed by #6486
Closed

AutocompleteInput cause material error when I want customize input style #6394

mohandes-jiri opened this issue Jun 25, 2021 · 7 comments · Fixed by #6486
Labels

Comments

@mohandes-jiri
Copy link
Contributor

I have a custom AutocompleteInput like this:

<AutocompleteInput
	{...props}
	variant="filled"
	options={{
		InputProps: {
			classes: {
				marginDense: classes.inputRoot,
				input: classes.input,
				underline: classes.inputUnderline,
				error: classes.inputError,
				ocused: classes.inputFocused,
			},
		},
	}}
/>

These classes delivered to the material Input component, not TextField and work fine.

But in console raising error like this:

Screenshot from 2021-06-25 15-17-31

Screenshot from 2021-06-25 15-17-42

When I investigating for reason in react admin project code I found this line

That return classes field in inputProps then in this line you pass this props to TextField component

@djhi
Copy link
Collaborator

djhi commented Jun 28, 2021

Thanks for reporting this. Please provide a sample application showing the issue by forking the following CodeSandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple).

@mohandes-jiri
Copy link
Contributor Author

@djhi
Hi,
I provide a sample at this link

https://codesandbox.io/s/frosty-tdd-plo2r?file=/src/comments/CommentCreate.tsx

Please check the console in creating the comment form.
Each render of this page causes the errors I mentioned above.

@mohandes-jiri
Copy link
Contributor Author

@djhi
Hi again!
Is my sample code OK?

@fzaninotto
Copy link
Member

Indeed, we're passing the InputProps to two different components. Thanks for the reproduction, I'm marking this as a bug.

@mohandes-jiri
Copy link
Contributor Author

@fzaninotto
You're right.
I think by sanitizing the InputProps to eject classes filed this issue should be solved easily.

@mohandes-jiri
Copy link
Contributor Author

@fzaninotto
I test 3.17.1 and still has errors.
I opened PR.
Thank you.

@mohandes-jiri
Copy link
Contributor Author

mohandes-jiri commented Aug 23, 2021

@djhi @fzaninotto
Hi, again guys,
I understand this definitely doesn't have priority for you, but the huge development error message heavily suffers us in the team.

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

Successfully merging a pull request may close this issue.

3 participants