Fix mix with string keys ending in ! - #967
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3132647a65
ℹ️ 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 "@codex address that feedback".
| when String | ||
| key.end_with?("!") ? key.chop.to_sym : key |
There was a problem hiding this comment.
Normalize string override keys to match string bases
If callers use string keys for attributes (e.g., data parsed from JSON), "class!" should override the existing "class" entry. Here the string override is converted to a symbol while the base string key is left unchanged, so the resulting hash contains both "class" and :class. When rendered, both produce a class attribute, so the override does not actually replace the original and can emit duplicate attributes. This only happens when both the base and override keys are strings.
Useful? React with 👍 / 👎.
Closes #963