betodealmeida commented on a change in pull request #19314:
URL: https://github.com/apache/superset/pull/19314#discussion_r838837896



##########
File path: 
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
##########
@@ -1252,6 +1430,24 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
                 />
                 {renderPreferredSelector()}
                 {renderAvailableSelector()}
+                <Upload
+                  name="databaseFile"
+                  id="databaseFile"
+                  data-test="database-file-input"
+                  accept=".yaml,.json,.yml,.zip"
+                  // upload is handled by hook
+                  customRequest={() => {}}
+                  onChange={info => onDbImport(info)}

Review comment:
       @lyndsiWilliams @hugh's suggestion does that! :)
   
   The best way to think of this IMHO is, when you write:
   
   ```js
   onChange={info => onDbImport(info)}
   ```
   
   You're assigning an anonymous function (`info => onDbImport(info)`) to 
`onChange`. What does that anonymous function do? It takes an `info` and 
returns the result of calling `onDbImport(info)`. But... isn't that the exact 
same thing that `onDbImport` does? Regardless of the value of `info`, passing 
it to the anonymous function returns the same result of pasing it to 
`onDbImport`, so they're identical.
   
   which means you can replace `info => onDbImport(info)` with `onDbImport`:
   
   ```js
   onChange={onDbImport}
   ```




-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to