Handle duplicate token conflicts gracefully#184
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| 'group' => 'Legacy', | ||
| ]; | ||
|
|
||
| if (array_key_exists($name, $tokensByName)) { | ||
| unset($tokensByName[$name]); | ||
| } | ||
|
|
||
| $tokensByName[$name] = $token; | ||
| $tokensByName[] = $token; | ||
| } |
There was a problem hiding this comment.
Preserve last CSS definition when importing duplicate tokens
convertCssToRegistry used to index declarations by name so the last occurrence replaced earlier ones, mirroring CSS’s cascade. After the change the code simply appends tokens and relies on normalizeRegistry() to deduplicate, which keeps the first encountered value. If the CSS source contains duplicate custom properties, importing the registry now yields the stale initial value, so a round‑trip through the admin UI will overwrite the effective CSS value with an older one and duplicates still aren’t surfaced. The import needs to retain last‑wins behaviour or explicitly pick the final conflicting token as canonical.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68dd41f3b84c832ebabf3cb50d349af9