rusackas commented on a change in pull request #19112:
URL: https://github.com/apache/superset/pull/19112#discussion_r829687530



##########
File path: superset-frontend/src/views/CRUD/hooks.ts
##########
@@ -464,7 +467,7 @@ export function useImportResource(
           updateState({ loading: false });
         });
     },
-    [],
+    [handleErrorMsg, resourceLabel, resourceName],

Review comment:
       Everyone keeps pinging this other guy 🤣 
   
   Appreciate the keen eyes on memoization, however. Generally, it's great to 
fix perf issues like this as bycatch, but I'm perfectly OK with filing a 
separate issue. That might help both PRs get through faster, and prevent larger 
"slippery slope" PRs.
   
   Let's just not lose track of the task... similar memoization (or lack 
thereof) issues have been cropping up all over, and the gains from fixing them 
are tangible.

##########
File path: superset-frontend/src/views/CRUD/hooks.ts
##########
@@ -448,7 +448,10 @@ export function useImportResource(
                 t(
                   'An error occurred while importing %s: %s',
                   resourceLabel,
-                  error.errors.map(payload => payload.message).join('\n'),
+                  [
+                    ...error.errors.map(payload => payload.message),
+                    'Please re-export your file and try importing again',

Review comment:
       Thanks for the catch! A few thoughts:
   * Are we sure that re-export and trying again will reliably fix the issue? I 
just want to make sure if we tell the user to take an action on the error that 
they have all the information they need to succeed at it.
   * Definitely do wrap UI strings in `t()` as a general practice
   * @kasiazjc has been capturing and evaluating error messages like this, and 
may have input on this one as well (cc @yousoph as well). 

##########
File path: superset-frontend/src/views/CRUD/utils.test.tsx
##########
@@ -146,6 +165,12 @@ test('detects if the error message is terminal or if it 
requires uses interventi
   expect(isTerminal).toBe(false);
 });
 
+test('error message is terminal when the extra field not contains other keys 
excepting issue_codes', () => {

Review comment:
       ```suggestion
   test('error message is terminal when the "extra" field contains only the 
"issue_codes key"', () => {
   ```

##########
File path: superset-frontend/src/views/CRUD/utils.test.tsx
##########
@@ -146,6 +165,12 @@ test('detects if the error message is terminal or if it 
requires uses interventi
   expect(isTerminal).toBe(false);
 });
 
+test('error message is terminal when the extra field not contains other keys 
excepting issue_codes', () => {

Review comment:
       ```suggestion
   test('error message is terminal when the "extra" field contains only the 
"issue_codes" key', () => {
   ```




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

Reply via email to