Skip to content

Commit 509a58d

Browse files
authored
Fix the prop onChange is marked as requires in EuiSwitch (#6735)
fix the prop onChange is marked as requires in EuiSwitch
1 parent c140f1f commit 509a58d

File tree

1 file changed

+5
-6
lines changed
  • plugins/main/public/components/common/permissions

1 file changed

+5
-6
lines changed

plugins/main/public/components/common/permissions/button.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ export const WzButtonPermissions = ({
5959
...(!['link', 'switch'].includes(buttonType)
6060
? { isDisabled: disabled }
6161
: { disabled }),
62-
onClick:
63-
disabled || !rest.onClick || buttonType == 'switch'
64-
? undefined
65-
: rest.onClick,
66-
onChange: disabled || !rest.onChange ? undefined : rest.onChange,
62+
onClick: disabled || !rest.onClick ? undefined : rest.onClick,
63+
onChange:
64+
!disabled || rest.onChange || buttonType === 'switch'
65+
? rest.onChange
66+
: undefined,
6767
};
68-
6968
if (buttonType == 'switch') delete additionalProps.onClick;
7069

7170
return additionalProps;

0 commit comments

Comments
 (0)