Fix issue with radio widget crashing (#922)
* fix types * Options Validaor checks for empty values Fixes: #662 Co-authored-by: Sanchit Jain <171220040@nitdelhi.ac.in>
This commit is contained in:
parent
1b8b3f7bbe
commit
858db968f6
|
|
@ -58,7 +58,7 @@ class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
|
|||
className={this.props.isLoading ? "bp3-skeleton" : ""}
|
||||
label={option.label}
|
||||
value={option.value}
|
||||
key={option.id}
|
||||
key={option.value}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,12 @@ export const VALIDATORS: Record<ValidationType, Validator> = {
|
|||
}
|
||||
const hasOptions = _.every(parsed, (datum: { label: any; value: any }) => {
|
||||
if (_.isObject(datum)) {
|
||||
return _.isString(datum.label) && _.isString(datum.value);
|
||||
return (
|
||||
_.isString(datum.label)
|
||||
&& _.isString(datum.value)
|
||||
&& !_.isEmpty(datum.label)
|
||||
&& !_.isEmpty(datum.value)
|
||||
);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ class RadioGroupWidget extends BaseWidget<RadioGroupWidgetProps, WidgetState> {
|
|||
export interface RadioOption {
|
||||
label: string;
|
||||
value: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface RadioGroupWidgetProps extends WidgetProps {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user