betodealmeida commented on a change in pull request #11983:
URL: 
https://github.com/apache/incubator-superset/pull/11983#discussion_r541156127



##########
File path: superset-frontend/src/views/CRUD/hooks.ts
##########
@@ -399,6 +439,7 @@ export function useImportResource<D extends object = any>(
     state: {
       loading: state.loading,

Review comment:
       Here we're returning `state`:
   
   ```javascript
   return {
     state: {
       loading: state.loading,
       passwordsNeeded: state.passwordsNeeded,
       alreadyExists: state.alreadyExists,
     },
     importResource,
   };
   ```
   
   So I think we could just return:
   
   ```javascript
   return {
     state,
     importResource,
   }
   ```
   
   But I think we want to return a **copy** of state here, which is why we 
redefine it ­— I followed the same logic from `useSingleViewResource`:
   
   
https://github.com/apache/incubator-superset/blob/4d329071a1651994574c3ad1f26e32b56d9ff810/superset-frontend/src/views/CRUD/hooks.ts#L302-L305
   
   @riahk any thoughts here?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to