This is an automated email from the ASF dual-hosted git repository.

lauraxia pushed a commit to branch antdUI-gravitino-base1.1.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/antdUI-gravitino-base1.1.0 by 
this push:
     new 9a587d3626 [#9614] fix switch table issue and expend tree node
9a587d3626 is described below

commit 9a587d3626b9c19b95eae370ffc776774ddef08c
Author: Qian Xia <[email protected]>
AuthorDate: Fri Jan 9 14:16:51 2026 +0800

    [#9614] fix switch table issue and expend tree node
---
 web/web/src/app/catalogs/TreeComponent.js |  2 +-
 web/web/src/app/catalogs/page.js          |  7 ++++++-
 web/web/src/lib/store/metalakes/index.js  | 20 +++++++++-----------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/web/web/src/app/catalogs/TreeComponent.js 
b/web/web/src/app/catalogs/TreeComponent.js
index 362ec0b3aa..2a7e0cce48 100644
--- a/web/web/src/app/catalogs/TreeComponent.js
+++ b/web/web/src/app/catalogs/TreeComponent.js
@@ -439,7 +439,7 @@ export const TreeComponent = forwardRef(function 
TreeComponent(props, ref) {
 
   const onExpand = (keys, { expanded, node }) => {
     if (node.inUse === 'false') return
-    dispatch(setExpandedNodes(keys))
+    dispatch(setExpanded(keys))
     setAutoExpandParent(false)
   }
 
diff --git a/web/web/src/app/catalogs/page.js b/web/web/src/app/catalogs/page.js
index 416328cb65..a4738affd2 100644
--- a/web/web/src/app/catalogs/page.js
+++ b/web/web/src/app/catalogs/page.js
@@ -49,7 +49,9 @@ import {
   getVersionDetails,
   setSelectedNodes,
   getCurrentEntityTags,
-  getCurrentEntityPolicies
+  getCurrentEntityPolicies,
+  resetActivatedDetails,
+  setActivatedDetailsLoading
 } from '@/lib/store/metalakes'
 
 import { fetchTags } from '@/lib/store/tags'
@@ -84,6 +86,7 @@ const CatalogsListPage = () => {
     async function fetchDependsData() {
       if ([...searchParams.keys()].length) {
         const { metalake, catalog, catalogType, schema, table, fileset, topic, 
model, version } = routeParams
+        await dispatch(setActivatedDetailsLoading(true))
 
         if (metalake) {
           dispatch(fetchTags({ metalake, details: true }))
@@ -171,6 +174,7 @@ const CatalogsListPage = () => {
           switch (catalogType) {
             case 'relational':
               await dispatch(fetchTables({ init: true, page: 'schemas', 
metalake, catalog, schema }))
+              await dispatch(resetActivatedDetails())
               await dispatch(getTableDetails({ init: true, metalake, catalog, 
schema, table }))
               await dispatch(
                 getCurrentEntityTags({
@@ -269,6 +273,7 @@ const CatalogsListPage = () => {
           }
           dispatch(getVersionDetails({ init: true, metalake, catalog, schema, 
model, version }))
         }
+        await dispatch(setActivatedDetailsLoading(false))
       }
     }
     fetchDependsData()
diff --git a/web/web/src/lib/store/metalakes/index.js 
b/web/web/src/lib/store/metalakes/index.js
index 263c07a2f0..764dcb60ee 100644
--- a/web/web/src/lib/store/metalakes/index.js
+++ b/web/web/src/lib/store/metalakes/index.js
@@ -555,9 +555,7 @@ export const fetchCatalogs = createAsyncThunk(
 export const getCatalogDetails = createAsyncThunk(
   'appMetalakes/getCatalogDetails',
   async ({ init, metalake, catalog }, { dispatch }) => {
-    init && dispatch(setActivatedDetailsLoading(true))
     const [err, res] = await to(getCatalogDetailsApi({ metalake, catalog }))
-    init && dispatch(setActivatedDetailsLoading(false))
 
     if (err || !res) {
       throw new Error(err)
@@ -732,9 +730,7 @@ export const fetchSchemas = createAsyncThunk(
 export const getSchemaDetails = createAsyncThunk(
   'appMetalakes/getSchemaDetails',
   async ({ init, metalake, catalog, schema }, { dispatch }) => {
-    init && dispatch(setActivatedDetailsLoading(true))
     const [err, res] = await to(getSchemaDetailsApi({ metalake, catalog, 
schema }))
-    init && dispatch(setActivatedDetailsLoading(false))
 
     if (err || !res) {
       throw new Error(err)
@@ -1031,9 +1027,7 @@ export const updateTable = createAsyncThunk(
     }
 
     if (init) {
-      await dispatch(setActivatedDetailsLoading(true))
       await dispatch(getTableDetails({ init, metalake, catalog, catalogType, 
schema, table }))
-      await dispatch(setActivatedDetailsLoading(false))
     } else {
       await dispatch(fetchTables({ metalake, catalog, catalogType, schema, 
page: 'schemas', init: true }))
     }
@@ -1126,11 +1120,9 @@ export const getFilesetDetails = createAsyncThunk(
     if (init) {
       await dispatch(resetTableData())
       await dispatch(setTableLoading(true))
-      await dispatch(setActivatedDetailsLoading(true))
     }
     const [err, res] = await to(getFilesetDetailsApi({ metalake, catalog, 
schema, fileset }))
     init && (await dispatch(setTableLoading(false)))
-    init && (await dispatch(setActivatedDetailsLoading(false)))
 
     if (err || !res) {
       throw new Error(err)
@@ -1436,9 +1428,7 @@ export const fetchModels = createAsyncThunk(
 export const getModelDetails = createAsyncThunk(
   'appMetalakes/getModelDetails',
   async ({ init, metalake, catalog, schema, model }, { getState, dispatch }) 
=> {
-    await dispatch(setActivatedDetailsLoading(true))
     const [err, res] = await to(getModelDetailsApi({ metalake, catalog, 
schema, model }))
-    await dispatch(setActivatedDetailsLoading(false))
 
     if (err || !res) {
       throw new Error(err)
@@ -1708,6 +1698,13 @@ export const appMetalakesSlice = createSlice({
     setTreeLoading(state, action) {
       state.treeLoading = action.payload
     },
+    resetActivatedDetails(state, action) {
+      state.activatedDetails = null
+
+      // Also clear table-related data to avoid stale content when switching 
details
+      state.tableData = []
+      state.tableProps = []
+    },
     setActivatedDetailsLoading(state, action) {
       state.activatedDetailsLoading = action.payload
     },
@@ -2147,7 +2144,8 @@ export const {
   setCatalogInUse,
   setMetalakeInUse,
   removeCatalogFromTree,
-  setTableProps
+  setTableProps,
+  resetActivatedDetails
 } = appMetalakesSlice.actions
 
 export default appMetalakesSlice.reducer

Reply via email to