[#12200] fix(web-v2): Gate metalake fetch until OAuth token is ready - #12203
Open
vanphuoc3012 wants to merge 1 commit into
Open
[#12200] fix(web-v2): Gate metalake fetch until OAuth token is ready#12203vanphuoc3012 wants to merge 1 commit into
vanphuoc3012 wants to merge 1 commit into
Conversation
Contributor
|
@LauraXia123 please help to review. |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the V2 Web UI metalakes page to avoid issuing metalake API requests before authentication bootstrap is ready (especially for OAuth/OIDC), reducing unauthorized/redirect-loop scenarios after login.
Changes:
- Adds
authType/authTokenawareness to gate the initialfetchMetalakes()dispatch until auth is ready. - Splits metalake store reset and metalake fetching into separate effects.
Comment on lines
+84
to
+90
| useEffect(() => { | ||
| if (!authType || (authType === 'oauth' && !authToken)) { | ||
| return | ||
| } | ||
|
|
||
| dispatch(fetchMetalakes()) | ||
| }, [authToken, authType, dispatch]) |
Comment on lines
+84
to
+86
| useEffect(() => { | ||
| if (!authType || (authType === 'oauth' && !authToken)) { | ||
| return |
Contributor
|
@vanphuoc3012 Would you check the comment? |
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.
What changes were proposed in this pull request?
This PR updates the V2 Web UI metalakes page to avoid fetching metalakes before authentication bootstrap is ready.
The metalake store reset still runs when the page mounts, but the metalake fetch now waits until the auth type is known. For OAuth/OIDC authentication, it also waits until the OAuth token exists in Redux before calling the metalake API.
Why are the changes needed?
Before this change, the metalakes page called
fetchMetalakes()immediately on mount. In OAuth/OIDC mode, this could race with the asynchronous auth bootstrap after login. The page could request metalake data before the access token was available, causing unauthorized API calls, redirects back to login, or an empty metalakes page.Fix: #12200
Does this PR introduce any user-facing change?
No user-facing API or configuration changes.
For OAuth/OIDC users, the V2 Web UI avoids making the metalake API request until the OAuth token is ready.
How was this patch tested?
Ran formatter for the V2 Web UI:
Verified the PR diff is minimal and only changes: