-
Notifications
You must be signed in to change notification settings - Fork 832
-
Notifications
You must be signed in to change notification settings - Fork 832
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
Warning: Prop htmlFor
did not match.
#741
Comments
htmlFor
did not match.htmlFor
did not match.
I can work on this |
You shouldn't really need to worry about this, although accessibility might take a small hit because of it. The app should still work, however. Can you try setting the |
|
Hm, Could you try explicitly passing your own |
@Chrischuck yeah, this helped, thanks :) |
@mikheevm What |
@Chrischuck in my case it were |
Was the |
@Chrischuck yes |
This would happen if you have a different number (or render order) of inputs on the SSR-rendered content than you do when the client renders the page. You can see why here – we are incrementing counters of the number of text inputs or selects: evergreen/src/select/src/SelectField.js Line 68 in 3a92e2f
evergreen/src/select/src/SelectField.js Line 94 in 3a92e2f
One idea, to give consumers more control, would be to let them actually define the We could potentially warn if we kept a global set of ids that Evergreen has seen, so consumers would know they are using the same ids in potentially problematic ways. |
@mshwery sorry, just trying to understand
It is exactly what I did, isn't it? So it's already possible. The browser would warn if there are elements with non-unique IDs, so the global set isn't really needed. So from my side it seems the easiest solution for now would be updating the docs for SSR part |
@mikheevm ah yes, ignore me – I had overlooked that the |
@sdoan16 is this something you can do? As I am new to SSR/Next.js it's hard for me to come up with good explanation of this which can be added to the docs |
@mikheevm I'll work on this. Also, if you could leave any feedback on my pr that would be great! |
Closing this out - the general workaround / rule that we've found for SSR is to manually pass in an |
Wrong repo, I'll go to mui/material, sorry for the noise. I ran into this today. I used the workaround of specifying an id. Is the work to actually fix this being tracked somewhere? It would be nice to have a build time message at least. I'm not using next.js - I'm using React 18 with renderToString on SSR and hydrateRoot on client. |
Bug report 🐞
Hello! I'm using next.js with evergreen-ui and I get this error on development server:
I'm new to next.js and wonder if this something I should care about? I'm sorry the code is closed source and I can't share it, but I will include minimal snippets which should be enough to reproduce the issue:
.babelrc
_document.tsx
pages/sign-in.tsx
components/ui/Input.tsx
Please consider the following items when filing a bug report:
Steps to reproduce
Go to
sign-in
page, refresh the page a couple of times, you should see the warning in the console.Versions
Expected.
No warning?
Actual
is shown in the console.
Browser name and version.
Chrome Version 79.0.3945.130 (Official Build) (64-bit)
Also reproduceable on Firefox 72.0.2 (64-bit)
Operating system.
macOS Catalina 10.15.3
The text was updated successfully, but these errors were encountered: