Copilot commented on code in PR #12203:
URL: https://github.com/apache/gravitino/pull/12203#discussion_r3654861926
##########
web-v2/web/src/app/metalakes/page.js:
##########
@@ -79,9 +79,16 @@ const MetalakeList = () => {
useEffect(() => {
dispatch(resetMetalakeStore())
- dispatch(fetchMetalakes())
}, [dispatch])
+ useEffect(() => {
+ if (!authType || (authType === 'oauth' && !authToken)) {
+ return
+ }
+
+ dispatch(fetchMetalakes())
+ }, [authToken, authType, dispatch])
Review Comment:
This effect depends on the *authToken value*, so it will re-dispatch
fetchMetalakes whenever the OAuth token is refreshed (authToken changes),
causing periodic and unnecessary metalake refetches while the user stays on
this page. Key the effect off an "auth ready" boolean so it only runs when
readiness flips from false → true.
##########
web-v2/web/src/app/metalakes/page.js:
##########
@@ -79,9 +79,16 @@ const MetalakeList = () => {
useEffect(() => {
dispatch(resetMetalakeStore())
- dispatch(fetchMetalakes())
}, [dispatch])
+ useEffect(() => {
+ if (!authType || (authType === 'oauth' && !authToken)) {
+ return
Review Comment:
This page-level gating does not prevent metalake fetching triggered from the
global layout: SiteHeader dispatches fetchMetalakes() for most non-login routes
(web-v2/web/src/app/rootLayout/SiteHeader.js:42-46), and UserSetting also
dispatches it (web-v2/web/src/app/rootLayout/UserSetting.js:55-59). Since
SiteHeader is always mounted (rootLayout/Layout.js:38-40), metalake API
requests can still be sent before OAuth bootstrap completes, so this change may
not fully resolve #12200. Consider applying the same auth-ready gate in those
call sites or moving the guard into fetchMetalakes itself.
--
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]