v5 hashPrefix reasoning and not configurable
See original GitHub issueReproduction link
Steps to reproduce
This issue is for version 5, although not possible to select. “antd”: “5.0.0-rc.2”,
What is expected?
No hashPrefix is needed
What is actually happening?
A hashPrefix is used for all elements. This causes for larger dom as the className is long. For example, a button renders this additional classname. ant-btn css-dev-only-do-not-override-w9vaau ant-btn-primary
There is no need to include the ‘css-dev-only-do-not-override’ multiple and multiple times throughout the DOM.
What is the reasoning for using a hashPrefix? With a styled-components approach you can directly target elements as needed and styled-components adds a unique id to each element, so it doesn’t make much sense why one is included?
This is also not able to be switched off currently.
var hashPrefix = true ? 'css-dev-only-do-not-override' : undefined;
Environment | Info |
---|---|
antd | 4.24.3 |
React | 18 |
System | 5 |
Browser | 5 |
There are comments for the hashPrefix such as: // Generate different prefix to make user selector break in production env. // This helps developer not to do style override directly on the hash id.
Not sure what the use for this is without any documentation?
Issue Analytics
- State:
- Created 10 months ago
- Reactions:3
- Comments:15 (8 by maintainers)
Top GitHub Comments
You may look for issues:
🤖 By issues-similarity-analysis
Awesome thank you @abenhamdine. I’ve upgraded and things are working as expected.