Fix: Deleting a tab from a tab widget from the explorer would not reflect in the canvas(#3218)
This commit is contained in:
parent
1e4878f983
commit
39e4990a7f
|
|
@ -40,6 +40,7 @@ import {
|
|||
SetWidgetDynamicPropertyPayload,
|
||||
updateWidgetProperty,
|
||||
UpdateWidgetPropertyPayload,
|
||||
updateWidgetPropertyRequest,
|
||||
UpdateWidgetPropertyRequestPayload,
|
||||
} from "actions/controlActions";
|
||||
import {
|
||||
|
|
@ -433,6 +434,23 @@ export function* deleteSaga(deleteAction: ReduxAction<WidgetDelete>) {
|
|||
// SPECIAL HANDLING FOR TABS IN A TABS WIDGET
|
||||
if (parent.type === WidgetTypes.TABS_WIDGET && widget.tabName) {
|
||||
widgetName = widget.tabName;
|
||||
// Deleting a tab from the explorer doesn't remove the same
|
||||
// from the "tabs" property of the widget.
|
||||
// So updating the widget property here when the children length doesn't match
|
||||
// `tabs` length
|
||||
if (parent.children?.length !== parent.tabs.length) {
|
||||
const filteredTabs = parent.tabs.filter(
|
||||
(tab: any) => tab.widgetId !== widgetId,
|
||||
);
|
||||
yield put(
|
||||
updateWidgetPropertyRequest(
|
||||
parentId,
|
||||
"tabs",
|
||||
filteredTabs,
|
||||
RenderModes.CANVAS,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (saveStatus && !disallowUndo) {
|
||||
Toaster.show({
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user