Skip to content

[#12200] fix(web-v2): Gate metalake fetch until OAuth token is ready - #12203

Open
vanphuoc3012 wants to merge 1 commit into
apache:mainfrom
vanphuoc3012:fix-oidc-metalakes-bootstrap
Open

[#12200] fix(web-v2): Gate metalake fetch until OAuth token is ready#12203
vanphuoc3012 wants to merge 1 commit into
apache:mainfrom
vanphuoc3012:fix-oidc-metalakes-bootstrap

Conversation

@vanphuoc3012

Copy link
Copy Markdown

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:

cd web-v2/web && pnpm format

Verified the PR diff is minimal and only changes:

web-v2/web/src/app/metalakes/page.js

@roryqi
roryqi requested a review from LauraXia123 July 27, 2026 02:01
@roryqi roryqi added the branch-1.3 Automatically cherry-pick commit to branch-1.3 label Jul 27, 2026
@jerryshao

Copy link
Copy Markdown
Contributor

@LauraXia123 please help to review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 / authToken awareness to gate the initial fetchMetalakes() 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
@LauraXia123

Copy link
Copy Markdown
Contributor

@vanphuoc3012 Would you check the comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch-1.3 Automatically cherry-pick commit to branch-1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] V2 Web UI fetches metalakes before OIDC authentication bootstrap completes

5 participants