Skip to content

feat: support setting non-primitive values as props instead of attr #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ronalduQualabs
Copy link

This PR updates the createComponent logic to ensure that when a web component attribute is a non-primitive (e.g. object, array), it is assigned directly as a property on the custom element.

This change addresses muxinc/media-chrome#1120, where the attribute rates in react its expected to be an array and was ignored by the current implementation.

@luwes
Copy link
Collaborator

luwes commented May 14, 2025

Closing this because the fix ended up being serializing the prop value. This was and edge case because in most cases when the property value is a complex value it doesn't have a reflecting attribute and the corresponding attribute wouldn't be observed. In this case ce-la-react correctly sets it as a property.

!elementClass.observedAttributes?.some((attr) => attr === attrName)

@luwes luwes closed this May 14, 2025
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