fix(sqllab): retry table metadata preview after OAuth2 redirect#42390
Draft
aminghadersohi wants to merge 1 commit into
Draft
fix(sqllab): retry table metadata preview after OAuth2 redirect#42390aminghadersohi wants to merge 1 commit into
aminghadersohi wants to merge 1 commit into
Conversation
The SQL Lab table column/metadata preview rendered a plain warning Alert on error, so an OAuth2 DB-auth 403 (error_type=OAUTH2_REDIRECT) showed a dead banner with no authorization link and never refetched after the user completed the OAuth2 dance elsewhere. Render the metadata error via ErrorMessageWithStackTrace with source="crud", passing the structured SupersetError through (error.errors[0]) so the registered OAuth2RedirectMessage component shows the authorization link and listens for completion, matching DatabaseSelector and TableExploreTree. The crud-source retry in OAuth2RedirectMessage only invalidated Schemas, Catalogs and Tables, so the table metadata queries (tagged TableMetadatas) were never refetched after re-auth. Add TableMetadatas to the invalidated tags so the preview auto-refreshes once the OAuth2 dance completes.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42390 +/- ##
==========================================
+ Coverage 65.03% 65.06% +0.02%
==========================================
Files 2744 2744
Lines 153627 153628 +1
Branches 35226 35226
==========================================
+ Hits 99915 99953 +38
+ Misses 51805 51768 -37
Partials 1907 1907
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Superset's per-user database OAuth2 flow signals uniformly via
OAuth2RedirectError(403,error_type=OAUTH2_REDIRECT). SQL Lab's DB/schema/table selectors already handle this: they render the error viaErrorMessageWithStackTrace source="crud", andOAuth2RedirectMessagelistens for the popup completion and retries by invalidating the relevant RTK Query tags.The SQL Lab table column/metadata preview (shown when expanding a table in the left panel) did not. On error it rendered a plain
<Alert type="warning">built from a flattened error string, so an OAuth2-required response never showed the authorization link and never refetched after the user completed the OAuth2 dance elsewhere — it just sat as a dead warning banner.This PR makes the preview consistent with the rest of SQL Lab:
TablePreview/index.tsx— render metadata errors viaErrorMessageWithStackTrace error={...} source="crud", passing the structuredSupersetError(error.errors[0]) that RTK Query already provides instead of flattening it to a string. This lets the registeredOAuth2RedirectMessagecomponent render the "provide authorization" link and listen for completion, exactly likeDatabaseSelector/TableExploreTree.OAuth2RedirectMessage.tsx— thecrud-source retry only invalidatedSchemas,Catalogs, andTables, but the table metadata queries (useTableMetadataQuery/useTableExtendedMetadataQuery) provide theTableMetadatastag. Without invalidating it, the preview would never refetch after re-auth. AddTableMetadatasto the invalidated tags so the preview auto-refreshes once the OAuth2 dance completes.BEFORE/AFTER
TESTING INSTRUCTIONS
Unit tests added:
TablePreview.test.tsx— a metadata error witherror_type=OAUTH2_REDIRECTrenders the OAuth2 authorization link.OAuth2RedirectMessage.test.tsx— thecrudretry now also invalidatesTableMetadatas.ADDITIONAL INFORMATION