[TextField] uniqueId breaks server rendering
See original GitHub issueProblem Description
The unique ID that is generated on textfields seems to break server rendering. The generated html looks like this:
<input
name="query"
id="query-MerchantEmailAddress-undefined-19669"
style="-webkit-tap-highlight-color:rgba(0,0,0,0);padding:0;position:relative;width:100%;height:100%;border:none;outline:none;background-color:rgba(0,0,0,0);color:rgba(255, 255, 255, 1);font:inherit;mui-prepared:;"
type="text"
data-reactid=".s5vj4rstmo.0.$=10=2$=011.$=10.1.0.$=10.2"
>
I am getting the standard react checksum error:
warning.js:45 Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) ilAddress-undefined-19669" style="-webki
(server) ilAddress-undefined-46463" style="-webki
Versions
- Material-UI: 0.15.0-alpha.2
- React: 0.14.7
- Browser: Chrome
Issue Analytics
- State:
- Created 8 years ago
- Reactions:16
- Comments:18 (14 by maintainers)
Top Results From Across the Web
[TextField] uniqueId breaks server rendering · Issue #3757
Problem Description The unique ID that is generated on textfields seems to break server rendering. The generated html looks like this:
Read more >Prop mismatch server/client, how to generate a unique ID ...
I'm using ReactJS.net with server rendering. I want to make a simple component that outputs a label and an input where the label...
Read more >Add server-side unique-ID or unique token validations
Overview: Implement an "advanced" server-side validation for the field. The field should have a randomly generator token which is bound to ...
Read more >Links in displayed text that break unwanted browser caching - ...
Problem: On a WP server configured for browser caching, I have a “Gateway Page” that renders an HTML field with two different sets...
Read more >Best practices for unique identifiers
This document provides guidance for selecting appropriate identifiers for your app based on your use case. For a general look at Android permissions, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nathanmarks have made the link between the label and the input more explicit on the
next
branch. E.g.Making the link more explicit allow us to remove the magic uniqueId generation. And solve the server-side rendering issue. I’m closing this issue as well as https://github.com/callemall/material-ui/pull/4253.
Adding to @halt-hammerzeit’s comment, adding an
id
prop toTextField
solved the issue for me.