Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6277 - Handle google login errors in Google sheet picker widget #6532

Merged
merged 4 commits into from Sep 27, 2023

Conversation

BLoe
Copy link
Collaborator

@BLoe BLoe commented Sep 27, 2023

What does this PR do?

Demo

https://www.loom.com/share/310a7839fd904b78ad093eb97a5acbc8

Checklist

  • Add tests
  • New files added to src/tsconfig.strictNullChecks.json (if possible)
  • Designate a primary reviewer

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (afff647) 70.03% compared to head (31911af) 70.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6532      +/-   ##
==========================================
- Coverage   70.03%   70.02%   -0.02%     
==========================================
  Files        1175     1175              
  Lines       36589    36613      +24     
  Branches     6902     6907       +5     
==========================================
+ Hits        25625    25638      +13     
- Misses      10964    10975      +11     
Files Coverage Δ
src/components/addBlockModal/AddBlockModal.tsx 84.14% <100.00%> (ø)
src/components/addBlockModal/BlockGridItem.tsx 83.33% <ø> (ø)
src/components/addBlockModal/useAddBlock.ts 98.33% <ø> (ø)
...omponents/annotationAlert/FieldAnnotationAlert.tsx 92.85% <100.00%> (ø)
src/components/form/FieldTemplate.tsx 98.07% <100.00%> (ø)
src/contrib/google/sheets/core/useSpreadsheetId.ts 93.87% <100.00%> (+0.26%) ⬆️
src/pageEditor/tabs/editTab/AnalysisResult.tsx 100.00% <ø> (ø)
src/types/annotationTypes.ts 100.00% <ø> (ø)
...ntrib/google/sheets/ui/SpreadsheetPickerWidget.tsx 83.72% <61.29%> (-6.94%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

setErrorAnnotation(null);
return schemaResult;
} catch (error: unknown) {
console.error(error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this left in intentionally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is that I'm catching all errors that stem from the getSpreadsheets() call (and surrounding logic, technically), not just the specific google sign-in errors. I figured that this was an ok trade-off to make right now, because, while it might make certain situations slightly harder for the user to understand what's happening, there is an obvious and immediate CTA to retry the request and recover in the UX. The downside here is that something like a "no internet connection" issue, if it happened right when the user tried to authenticate with the PKCE integration, would also produce the exact same error message and it might not totally be clear to the user what's happening. But I think this is a better trade-off than showing the user a stack trace (error boundary) in this situation and forcing them to reload the page editor.

The upshot of all this is that I left the console.error in here on purpose so that at least the real error is reported to the console for debugging purposes if we run into issues with non-login errors in this code.

@BLoe BLoe merged commit eaa2c4d into main Sep 27, 2023
11 checks passed
@BLoe BLoe deleted the feature/6277-gsheets-error-handling branch September 27, 2023 17:44
@grahamlangford grahamlangford added this to the 1.8.0 milestone Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants