Closed devjoseluis closed 2 years ago
The native web component was a big mistake, it led to so many issues… I ended up rolling back to v1
state, without web component (pure React implementation). The issue should be fixed starting from the v3.0.11
.
Description
On the initial render of
ReactPinField
, the props passed are transmitted to the child inputs and removed from the root element, but when the props value gets updated, the root element gets synced, but the child inputs do not.Expected Behavior
The props should be synced to the child inputs and removed from the root element.
Actual Behavior
The props updates only apply to the root element.
Possible Fix
Maybe listen for the props changes in the
attributeChangedCallback
of the https://github.com/soywod/pin-field web component: https://github.com/soywod/pin-field/blob/d398dc287c606fe4eefd57a5c79abc439cc9c092/src/index.ts#L124And do something like in the
connectedCallback
, pass the props to the child inputs and remove them from the root element: https://github.com/soywod/pin-field/blob/d398dc287c606fe4eefd57a5c79abc439cc9c092/src/index.ts#L155-L162.Steps to Reproduce
ReactPinField
component. (ex.className={someDynamicState}
).<swd-pin-field>
component.The demo in the repository shows the bug: https://github.com/soywod/react-pin-field/blob/133b5a5ed4de523f9572117229e80989eed65aa4/src/demo/index.tsx#L51-L53
Environment