feat(ui): remove extraneous formContainerChildrenReordered action

This commit is contained in:
psychedelicious
2025-02-20 15:44:45 +10:00
parent 340c9c0697
commit 4f2de2674e
2 changed files with 4 additions and 14 deletions

View File

@@ -28,8 +28,8 @@ import {
import { getEditModeWrapperId } from 'features/nodes/components/sidePanel/builder/shared';
import { selectNodesSlice } from 'features/nodes/store/selectors';
import {
formContainerChildrenReordered,
formElementAdded,
formElementContainerDataChanged,
formElementReparented,
selectFormRootElementId,
selectWorkflowSlice,
@@ -260,7 +260,7 @@ export const useBuilderDndMonitor = () => {
const container = getElement(targetElement.parentId, isContainerElement);
const startIndex = container.data.children.indexOf(sourceElement.id);
const indexOfTarget = container.data.children.indexOf(targetElement.id);
const reorderedLayout = reorderWithEdge({
const reorderedChildren = reorderWithEdge({
list: container.data.children,
startIndex,
indexOfTarget,
@@ -268,9 +268,9 @@ export const useBuilderDndMonitor = () => {
axis: container.data.layout === 'row' ? 'horizontal' : 'vertical',
});
dispatchAndFlash(
formContainerChildrenReordered({
formElementContainerDataChanged({
id: container.id,
children: reorderedLayout,
changes: { children: reorderedChildren },
}),
sourceElement.id
);

View File

@@ -182,15 +182,6 @@ export const workflowSlice = createSlice({
removeElement({ form, id });
delete state.formFieldInitialValues[id];
},
formContainerChildrenReordered: (state, action: PayloadAction<{ id: string; children: string[] }>) => {
const { form } = state;
const { id, children } = action.payload;
const container = form.elements[id];
if (!container || !isContainerElement(container)) {
return;
}
container.data.children = children;
},
formElementReparented: (state, action: PayloadAction<{ id: string; newParentId: string; index: number }>) => {
const { form } = state;
const { id, newParentId, index } = action.payload;
@@ -338,7 +329,6 @@ export const {
formElementAdded,
formElementRemoved,
formElementReparented,
formContainerChildrenReordered,
formElementHeadingDataChanged,
formElementTextDataChanged,
formElementNodeFieldDataChanged,