msyavuz commented on code in PR #35289:
URL: https://github.com/apache/superset/pull/35289#discussion_r2454643001
##########
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx:
##########
@@ -555,11 +574,20 @@ const ExtraOptions = ({
<Input
type="text"
name="schemas_allowed_for_file_upload"
- value={(
- extraJson?.schemas_allowed_for_file_upload || []
- ).join(',')}
+ value={schemasText}
placeholder="schema1,schema2"
- onChange={onExtraInputChange}
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
Review Comment:
```suggestion
onChange={(e) =>
```
##########
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx:
##########
@@ -58,7 +58,17 @@ const ExtraOptions = ({
onTextChange: EventHandler<ChangeEvent<HTMLTextAreaElement>>;
onEditorChange: Function;
onExtraInputChange: (
- e: CheckboxChangeEvent | ChangeEvent<HTMLInputElement>,
+ e:
+ | CheckboxChangeEvent
+ | React.ChangeEvent<HTMLInputElement>
Review Comment:
```suggestion
| ChangeEvent<HTMLInputElement>
```
##########
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx:
##########
@@ -555,11 +574,20 @@ const ExtraOptions = ({
<Input
type="text"
name="schemas_allowed_for_file_upload"
- value={(
- extraJson?.schemas_allowed_for_file_upload || []
- ).join(',')}
+ value={schemasText}
placeholder="schema1,schema2"
- onChange={onExtraInputChange}
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
+ setSchemasText(e.target.value)
+ }
+ onBlur={() =>
+ onExtraInputChange({
+ target: {
+ type: 'text',
+ name: 'schemas_allowed_for_file_upload',
+ value: schemasText,
+ },
+ })
+ }
Review Comment:
A type assertion here would be simpler than adding a seperate type
definition above on the function definition
```suggestion
onBlur={() =>
onExtraInputChange({
target: {
type: 'text',
name: 'schemas_allowed_for_file_upload',
value: schemasText,
},
} as ChangeEvent<HTMLInputElement>)
}
```
##########
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx:
##########
@@ -58,7 +58,17 @@ const ExtraOptions = ({
onTextChange: EventHandler<ChangeEvent<HTMLTextAreaElement>>;
onEditorChange: Function;
onExtraInputChange: (
- e: CheckboxChangeEvent | ChangeEvent<HTMLInputElement>,
+ e:
+ | CheckboxChangeEvent
+ | React.ChangeEvent<HTMLInputElement>
+ | {
+ target: {
+ type: string;
+ name: string;
+ value: string;
+ checked?: boolean;
+ };
+ },
Review Comment:
We could get rid of this by just asserting the type below
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]