fix: React 19+ complex reflected prop/attr bug#4
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a bug in React 19+ related to property/attribute reflection by refining how attribute values are assigned.
- Introduces a check comparing the result of default conversion (via defaultToAttributeValue) against the provided attrValue
- Updates the assignment to reactProps accordingly in the src/ce-la-react.ts file
Comments suppressed due to low confidence (1)
src/ce-la-react.ts:248
- [nitpick] Consider renaming 'v' to a more descriptive name to clarify its role relative to 'attrValue'.
const attrValueFromDefault = defaultToAttributeValue(v);
| // default conversion. Then the different value has to be passed | ||
| // This might be an array or object conversion to a string. | ||
| const attrValueFromDefault = defaultToAttributeValue(v); | ||
|
|
There was a problem hiding this comment.
Add an inline comment to clarify the rationale behind selecting 'attrValue' when it differs from the default-converted value and falling back to 'v' otherwise, ensuring future maintainers understand the edge-case logic for React 19+.
Suggested change
| // If the attribute value differs from the default-converted value, | |
| // use the explicitly converted `attrValue`. This ensures that any | |
| // custom serialization (e.g., for arrays or objects) is respected. | |
| // Otherwise, fall back to the original value `v` to let React handle | |
| // it natively. This logic is specific to React 19+ behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
related muxinc/media-chrome#1140
I noticed the
ratesissue was not fixed yet in Next 15 / React 19.