Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The root issue is that Alert defines a Component Token named borderRadius, which conflicts with the existing Global Token. Component configuration already supports overriding Global Tokens locally, so introducing a Component Token with the same name makes the meaning ambiguous. This patch fixes the missing CSS variable, but we should fix the conflicting token definition in Alert first. |
|
Agreed on Alert. The docs already describe The missing declaration is still a separate problem in this repo. Both paths start from the same This is current master, with a plain test component and no Alert involved:
Alert and Notification are the only components that name tokens this way today, so fixing Alert does clear the visible bug. The failure is still silent. It only shows when the two values match, and nothing catches that at review time. The patch only covers keys that Happy to fix Alert too. Tell me if you would rather this repo warn about the collision instead of aliasing the variable. |
getComponentTokendrops a component token whose value is identical to the global token of the same name, so its CSS variable is never declared. The style layer still points atvar(--ant-<component>-<key>), which then resolves to nothing.It shows up in antd as ant-design/ant-design#59241: with
borderRadiusset to 4,borderRadiusLGderives to 4 as well, Alert'sborderRadiuscomponent token gets dropped, and--ant-alert-border-radiusis missing, so the Alert loses its radius. The two are only equal by coincidence here, Alert really wantsborderRadiusLG, so they can't be conflated.Those keys now get declared as an alias of the global variable. Doing it on the declaration side keeps the style rules themselves free of any token value, which matters because
useStyleRegistercaches them per prefix rather than per theme.