laserninja commented on code in PR #12900:
URL: https://github.com/apache/gravitino/pull/12900#discussion_r4290286160


##########
web-v2/web/src/lib/store/metalakes/index.js:
##########
@@ -3041,68 +3270,87 @@ export const appMetalakesSlice = createSlice({
       }
     })
     builder.addCase(fetchModelVersions.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
     builder.addCase(fetchFunctions.fulfilled, (state, action) => {
       state.functions = action.payload.functions
     })
-    builder.addCase(getFunctionDetails.fulfilled, (state, action) => {
-      if (action.payload.init) {
-        state.activatedDetails = action.payload.function
-      }
-    })
     builder.addCase(fetchFunctions.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
-        toast.error(action.error.message)
-      }
-    })
-    builder.addCase(getFunctionDetails.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
     builder.addCase(fetchViews.fulfilled, (state, action) => {
       state.views = action.payload.views
     })
     builder.addCase(fetchViews.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
-    builder.addCase(getViewDetails.fulfilled, (state, action) => {
-      if (action.payload.init) {
-        state.activatedDetails = action.payload.view
+    builder.addCase(deleteView.rejected, (state, action) => {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
+        toast.error(action.error.message)
+      }
+    })
+    builder.addCase(fetchSemanticModels.pending, (state, action) => {
+      const key = semanticModelSchemaKey(action.meta.arg)
+      trackSemanticModelRequest(state, key, action.meta.requestId, true)
+      if (!state.activeCatalogEntity || state.activeSemanticModelSchema === 
key)
+        state.semanticModelListRequestId = action.meta.requestId
+    })
+    builder.addCase(fetchSemanticModels.fulfilled, (state, action) => {
+      const key = semanticModelSchemaKey(action.meta.arg)
+      const request = state.semanticModelRequests[key]
+      if (!action.payload.stale && request?.requestId === 
action.meta.requestId) {
+        const data = mergeWithSemanticModelNodes({
+          tree: state.metalakeTree,
+          key,
+          entities: action.payload.semanticModels
+        })
+        state.metalakeTree = updateTreeData(state.metalakeTree, key, data)

Review Comment:
   Fixed in 2b3242275. I reproduced the fresh-link failure before the fix: the 
schema showed only Semantic Models and never fetched its table siblings. 
Restored the `init && loadedNodes.includes(schemaKey)` guard around the tree 
merge while keeping the visible list update independent. A regression test now 
mounts the real catalog page and tree from a fresh model URL and checks table, 
view, function, and model siblings. The same Chromium scenario now shows all 
children.



##########
web-v2/web/src/lib/store/metalakes/index.js:
##########
@@ -3041,68 +3270,87 @@ export const appMetalakesSlice = createSlice({
       }
     })
     builder.addCase(fetchModelVersions.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
     builder.addCase(fetchFunctions.fulfilled, (state, action) => {
       state.functions = action.payload.functions
     })
-    builder.addCase(getFunctionDetails.fulfilled, (state, action) => {
-      if (action.payload.init) {
-        state.activatedDetails = action.payload.function
-      }
-    })
     builder.addCase(fetchFunctions.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
-        toast.error(action.error.message)
-      }
-    })
-    builder.addCase(getFunctionDetails.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
     builder.addCase(fetchViews.fulfilled, (state, action) => {
       state.views = action.payload.views
     })
     builder.addCase(fetchViews.rejected, (state, action) => {
-      if (!action.error.message.includes('CanceledError')) {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
         toast.error(action.error.message)
       }
     })
-    builder.addCase(getViewDetails.fulfilled, (state, action) => {
-      if (action.payload.init) {
-        state.activatedDetails = action.payload.view
+    builder.addCase(deleteView.rejected, (state, action) => {
+      if (!action.meta.aborted && 
!action.error.message.includes('CanceledError')) {
+        toast.error(action.error.message)
+      }
+    })
+    builder.addCase(fetchSemanticModels.pending, (state, action) => {
+      const key = semanticModelSchemaKey(action.meta.arg)
+      trackSemanticModelRequest(state, key, action.meta.requestId, true)
+      if (!state.activeCatalogEntity || state.activeSemanticModelSchema === 
key)
+        state.semanticModelListRequestId = action.meta.requestId
+    })
+    builder.addCase(fetchSemanticModels.fulfilled, (state, action) => {
+      const key = semanticModelSchemaKey(action.meta.arg)
+      const request = state.semanticModelRequests[key]
+      if (!action.payload.stale && request?.requestId === 
action.meta.requestId) {
+        const data = mergeWithSemanticModelNodes({
+          tree: state.metalakeTree,
+          key,
+          entities: action.payload.semanticModels
+        })
+        state.metalakeTree = updateTreeData(state.metalakeTree, key, data)

Review Comment:
   Fixed in 2b3242275 by restoring the original loaded-node and `init` guard. 
An empty Semantic Model result still updates the visible list, but leaves an 
unloaded schema and its `isLeaf` state untouched so expansion can fetch the 
complete child list. Added reducer coverage for both empty and nonempty lists, 
plus real-tree component coverage. I also reproduced the missing switcher in 
Chromium before the fix and verified that the schema stays expandable and its 
tables remain reachable afterward.



##########
web-v2/web/src/lib/store/metalakes/index.js:
##########
@@ -2364,6 +2535,25 @@ export const appMetalakesSlice = createSlice({
     currentEntityPolicies: []
   },
   reducers: {
+    setActiveCatalogEntity(state, action) {
+      const key = catalogEntityKey(action.payload)
+      const schemaKey = action.payload.schema ? 
semanticModelSchemaKey(action.payload) : null
+      if (state.activeSemanticModelSchema !== schemaKey) state.semanticModels 
= []
+      state.activeSemanticModelSchema = schemaKey
+      if (state.activeCatalogEntity === key) return
+      state.activeCatalogEntity = key
+      state.activatedDetails = null

Review Comment:
   Fixed in 2b3242275. Version URLs render the parent model header and versions 
list, so they now use the existing model-loading path in `page.js`, including 
`getModelDetails` and `fetchModelVersions`. The version remains in the request 
identity so the shared detail guard still rejects stale results. 
`getVersionDetails` continues returning the version payload for the version 
dialogs. Tests cover direct version links, model-to-version navigation, and a 
delayed header response after leaving the route. Chromium checks confirm that 
the parent comment, properties, and version rows are populated.



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