From 461d7263582e459c354855ee085050751e4b82d7 Mon Sep 17 00:00:00 2001 From: Bavin Edwards <65621465+zerico007@users.noreply.github.com> Date: Wed, 15 Feb 2023 12:24:22 -0500 Subject: [PATCH 1/2] hot fix for react component prop having same name as an html attribute --- src/react-to-webcomponent.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/react-to-webcomponent.js b/src/react-to-webcomponent.js index 9b3326d..a31019a 100644 --- a/src/react-to-webcomponent.js +++ b/src/react-to-webcomponent.js @@ -79,7 +79,11 @@ export default function (ReactComponent, React, ReactDOM, options = {}) { renderAddedProperties[key] || key in target ) { - return Reflect.set(target, key, value, receiver) + // If the property is already defined on the component, just set it. + if (this.has(target, key)) { + define.expando(receiver, key, value) + } + // Set it on the HTML element as well. } else { define.expando(receiver, key, value) } From a0cf08d67a295ed8820e0057b8576df3bb72efd8 Mon Sep 17 00:00:00 2001 From: Bavin Edwards <65621465+zerico007@users.noreply.github.com> Date: Thu, 16 Feb 2023 06:06:31 -0500 Subject: [PATCH 2/2] test fix --- src/react-to-webcomponent.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/react-to-webcomponent.js b/src/react-to-webcomponent.js index a31019a..92df360 100644 --- a/src/react-to-webcomponent.js +++ b/src/react-to-webcomponent.js @@ -79,11 +79,12 @@ export default function (ReactComponent, React, ReactDOM, options = {}) { renderAddedProperties[key] || key in target ) { - // If the property is already defined on the component, just set it. - if (this.has(target, key)) { + // If the property is defined in the component props, just set it. + if (ReactComponent.propTypes && key in ReactComponent.propTypes) { define.expando(receiver, key, value) } // Set it on the HTML element as well. + return Reflect.set(target, key, value, receiver) } else { define.expando(receiver, key, value) }