You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{useState}from'react';import{OuiCheckableCard}from'@opensearch-project/oui';import{htmlIdGenerator}from'@opensearch-project/oui/lib/services';exportdefault()=>{return(<OuiCheckableCardid={htmlIdGenerator()()}label="I am a checkbox"checkableType="checkbox"value="checkbox1"checked={checkbox}onChange={()=>{console.log("on change called.");}}/>);};
The on change called will output twice after checkbox clicked.
Expected behavior
It should only fired once for single checkbox click.
Screenshots
Host/Environment (please complete the following information):
OUI Version: [e.g. 1.0]
OSD Version (if applicable): [e.g. 2.7.0]
OS: [e.g. iOS]
Browser and version [e.g. Chrome 90]
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
The
onChange
property ofOuiCheckableCard
will be triggered twice after checkbox clicked. TheonChange
callback should only be fired once for single checkbox click. It seems the duplicatedonChange
was be fired by [this line].(https://github.com/opensearch-project/oui/blob/main/src/components/card/checkable_card/checkable_card.tsx#L113)To Reproduce
Here is the sample code:
The
on change called
will output twice after checkbox clicked.Expected behavior
It should only fired once for single checkbox click.
Screenshots
Host/Environment (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: