Skip to content

Commit

Permalink
Add null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Sep 18, 2020
1 parent 7a50789 commit 20259fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion superset-frontend/src/SqlLab/components/LimitControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class LimitControl extends React.PureComponent<
event: React.FormEvent<FormControl & FormControlProps>,
) =>
this.setState({
textValue: (event.currentTarget.value as string) ?? '',
textValue: (event.currentTarget?.value as string) ?? '',
})
}
/>
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/DeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function DeleteModal({
onChange={(
event: React.FormEvent<FormControl & FormControlProps>,
) => {
const targetValue = (event.currentTarget.value as string) ?? '';
const targetValue = (event.currentTarget?.value as string) ?? '';
setDisableChange(targetValue.toUpperCase() !== 'DELETE');
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/datasource/ChangeDatasourceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
const changeSearch = (
event: React.FormEvent<FormControl & FormControlProps>,
) => {
setFilter((event.currentTarget.value as string) ?? '');
setFilter((event.currentTarget?.value as string) ?? '');
};

return (
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/explore/components/PropertiesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) {
value={name}
onChange={(
event: React.FormEvent<FormControl & FormControlProps>,
) => setName((event.currentTarget.value as string) ?? '')}
) => setName((event.currentTarget?.value as string) ?? '')}
/>
</FormGroup>
<FormGroup>
Expand All @@ -191,7 +191,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) {
onChange={(
event: React.FormEvent<FormControl & FormControlProps>,
) =>
setDescription((event.currentTarget.value as string) ?? '')
setDescription((event.currentTarget?.value as string) ?? '')
}
style={{ maxWidth: '100%' }}
/>
Expand All @@ -215,7 +215,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) {
event: React.FormEvent<FormControl & FormControlProps>,
) => {
const targetValue =
(event.currentTarget.value as string) ?? '';
(event.currentTarget?.value as string) ?? '';
setCacheTimeout(targetValue.replace(/[^0-9]/, ''));
}}
/>
Expand Down

0 comments on commit 20259fe

Please sign in to comment.