Skip to content

Commit 413b8d0

Browse files
authored
fix: Modify after a block is deleted from a group (opentiny#1506)
1 parent 77e44c8 commit 413b8d0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/plugins/materials/src/meta/block/src/BlockPanel.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default {
4646
rightPanelRef: Object
4747
},
4848
setup(props) {
49-
const { addDefaultGroup, isDefaultGroupId, isAllGroupId, isRefresh, selectedGroup } = useBlock()
49+
const { addDefaultGroup, isDefaultGroupId, isAllGroupId, isRefresh, selectedGroup, getGroupList, setGroupList } =
50+
useBlock()
5051
const { materialState } = useMaterial()
5152
const { message } = useModal()
5253
const getAppId = () => getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id
@@ -111,6 +112,13 @@ export default {
111112
fetchGroupBlocksById({ groupId, value })
112113
.then((data) => {
113114
state.groupData = data
115+
const list = getGroupList()?.map((item) => {
116+
if (item.id === groupId) {
117+
item.blocks = data
118+
}
119+
return item
120+
})
121+
setGroupList(list)
114122
})
115123
.catch((error) => {
116124
state.groupData = []

0 commit comments

Comments
 (0)