Copilot commented on code in PR #11300:
URL: https://github.com/apache/gravitino/pull/11300#discussion_r3329876063


##########
web-v2/web/src/lib/store/metalakes/index.js:
##########
@@ -2187,8 +2187,14 @@ export const fetchViews = createAsyncThunk(
   async ({ init, metalake, catalog, schema }, { getState, dispatch }) => {
     const [err, res] = await to(getViewsApi({ metalake, catalog, schema }))
 
-    if (init && (err || !res)) {
-      throw new Error(err)
+    if (err || !res) {
+      // Catalog doesn't support views (HTTP 405) — return empty views silently
+      if (err?.response?.status === 405) {
+        return { views: [], init }

Review Comment:
   This 405 branch does not actually suppress the error toast for list-views 
requests. `getViewsApi` uses `defHttp` with the default `errorMessageMode: 
'message'`, so the axios response interceptor calls `checkStatus` and shows the 
405 toast before the error reaches this thunk; this return only bypasses the 
slice's rejected-handler toast. Please suppress the interceptor toast for this 
expected request path (for example by passing `errorMessageMode: 'none'` 
through the views API call) and then handle 405 locally.



##########
web-v2/web/src/lib/store/metalakes/index.js:
##########
@@ -2236,6 +2242,10 @@ export const getViewDetails = createAsyncThunk(
     const [err, res] = await to(getViewDetailsApi({ metalake, catalog, schema, 
view }))
 
     if (err || !res) {
+      // Catalog doesn't support views (HTTP 405) — return empty result 
silently
+      if (err?.response?.status === 405) {
+        return { view: null, init }
+      }

Review Comment:
   This detail-view 405 branch also runs after the global axios interceptor has 
already emitted the 405 toast because `getViewDetailsApi` uses the default 
`errorMessageMode: 'message'`. As a result, navigating to a view detail route 
in a catalog that does not support views can still show the toast this PR is 
trying to suppress. Please disable the interceptor toast for this expected 
request and keep the local 405 handling here.



-- 
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]

Reply via email to