Skip to content

Commit 877471c

Browse files
authored
Content: Also delete siblings of a deleted content item in a multi-lang instance (#3986)
When deleting a content item in a multi-lang instance, also delete the siblings that are on a different language from the cache. Resolves #3980 [Screencast_20260205_090332.webm](https://github.com/user-attachments/assets/d9eaac20-155a-4830-9fa0-a962a9e3b03b)
1 parent 55717f0 commit 877471c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/shell/store/content.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,23 @@ export function content(state = {}, action) {
128128

129129
case "REMOVE_ITEM":
130130
let removed = { ...state };
131+
const itemToRemove = removed[action.itemZUID];
132+
// Get the item ZUIDs of all the siblings for multi-lang instances
133+
const siblingItems = itemToRemove?.siblings
134+
? Object.values(itemToRemove.siblings)?.filter(
135+
(item) => item !== action.itemZUID
136+
)
137+
: [];
138+
139+
// Remove the actual item
131140
delete removed[action.itemZUID];
141+
// Remove siblings in a diff language for multi-lang instances
142+
if (siblingItems.length) {
143+
siblingItems.forEach((itemZUID) => {
144+
delete removed[itemZUID];
145+
});
146+
}
147+
132148
return removed;
133149

134150
case "SET_ITEM_WEB":

0 commit comments

Comments
 (0)