Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#9714] web-v2(UI): removeTopicFromStore after dropping topic (#10089)

Qian Xia0990dab7c035
diff --git a/web-v2/web/src/lib/store/metalakes/index.js b/web-v2/web/src/lib/store/metalakes/index.js
index 6a77e58777..4eeba36c57 100644
--- a/web-v2/web/src/lib/store/metalakes/index.js
+++ b/web-v2/web/src/lib/store/metalakes/index.js
@@ -1391,9 +1391,8 @@ export const deleteTopic = createAsyncThunk(
if (err || !res) {
throw new Error(err)
}
- await dispatch(setTableLoading(true))
- await dispatch(fetchTopics({ metalake, catalog, catalogType, schema, page: 'topics', init: true }))
- await dispatch(setTableLoading(false))
+
+ dispatch(removeTopicFromStore({ metalake, catalog, catalogType, schema, topic }))
return res
}
@@ -1829,6 +1828,21 @@ export const appMetalakesSlice = createSlice({
setTableProps(state, action) {
state.tableProps = action.payload
},
+ removeTopicFromStore(state, action) {
+ const { metalake, catalog, catalogType, schema, topic } = action.payload
+ const effectiveCatalogType = catalogType || 'messaging'
+ const schemaKey = `{{${metalake}}}{{${catalog}}}{{${effectiveCatalogType}}}{{${schema}}}`
+ const topicKey = `{{${metalake}}}{{${catalog}}}{{${effectiveCatalogType}}}{{${schema}}}{{${topic}}}`
+
+ state.topics = state.topics.filter(item => item.name !== topic)
+ state.tableData = state.tableData.filter(item => !(item?.node === 'topic' && item?.name === topic))
+ state.selectedNodes = state.selectedNodes.filter(key => key !== topicKey)
+
+ const schemaNode = findInTree(state.metalakeTree, 'key', schemaKey)
+ if (schemaNode?.children?.length) {
+ schemaNode.children = schemaNode.children.filter(item => item.key !== topicKey)
+ }
+ },
resetMetalakeStore(state, action) {
if (!action.payload?.isCacheMetalakes) {
state.metalakes = []
@@ -2229,6 +2243,7 @@ export const {
setCatalogInUse,
updateCatalogInUse,
setMetalakeInUse,
+ removeTopicFromStore,
removeCatalogFromTree,
setTableProps,
resetActivatedDetails