Просмотр исходного кода

fix(ui): Boolean field should not pass 'type' down to SwitchButton (#37822)

* fix(ui): Ensure switch button always has type=button

* fix(ui): Ensure boolean field does not pass down type to switch button
David Wang 2 лет назад
Родитель
Сommit
1e9da153d9
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      static/app/components/forms/booleanField.tsx

+ 3 - 1
static/app/components/forms/booleanField.tsx

@@ -45,13 +45,15 @@ export default class BooleanField extends Component<BooleanFieldProps> {
           disabled: boolean;
           onBlur: onEvent;
           onChange: onEvent;
+          type: string;
           value: any;
         }) => {
           // Create a function with required args bound
           const handleChange = this.handleChange.bind(this, value, onChange, onBlur);
 
+          const {type: _, ...propsWithoutType} = props;
           const switchProps = {
-            ...props,
+            ...propsWithoutType,
             size: 'lg' as React.ComponentProps<typeof Switch>['size'],
             isActive: !!value,
             isDisabled: disabled,