Skip to content

fix: React 19+ complex reflected prop/attr bug#4

Merged
luwes merged 1 commit intomainfrom
fix-complex-attr-19
May 16, 2025
Merged

fix: React 19+ complex reflected prop/attr bug#4
luwes merged 1 commit intomainfrom
fix-complex-attr-19

Conversation

@luwes
Copy link
Copy Markdown
Collaborator

@luwes luwes commented May 16, 2025

related muxinc/media-chrome#1140

I noticed the rates issue was not fixed yet in Next 15 / React 19.

@luwes luwes self-assigned this May 16, 2025
@luwes luwes requested a review from Copilot May 16, 2025 02:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Comment thread src/ce-la-react.ts
// 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);

Copy link

Copilot AI May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@luwes luwes merged commit 8483bc6 into main May 16, 2025
6 checks passed
@luwes luwes deleted the fix-complex-attr-19 branch May 16, 2025 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants