This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 0990dab7c0 [#9714] web-v2(UI): removeTopicFromStore after dropping
topic (#10089)
0990dab7c0 is described below
commit 0990dab7c035e2ef2ea95d317479408442454ccf
Author: Qian Xia <[email protected]>
AuthorDate: Mon Mar 2 11:21:37 2026 +0800
[#9714] web-v2(UI): removeTopicFromStore after dropping topic (#10089)
### What changes were proposed in this pull request?
`removeTopicFromStore` replace `fetchTopics` after dropping topic
### Why are the changes needed?
topic broker sync issue
Fix: #9714
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
manually
---
web-v2/web/src/lib/store/metalakes/index.js | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
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