Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/ce-la-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,18 @@ export function createComponent<I extends HTMLElement, E extends EventNames = {}

// React 19+ handles the property / attribute values itself.
if (attrName && IS_REACT_19_OR_NEWER) {
reactProps[attrName] = v;

// The goal is to let React 19 handle the property / attribute values
// itself unless toAttributeValue returns a different value than the
// 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.
if (attrValue !== attrValueFromDefault) {
reactProps[attrName] = attrValue;
} else {
reactProps[attrName] = v;
}
}
}

Expand Down