From 9d4b71ffbc0726b485cbb8c284f17f12fbb95a66 Mon Sep 17 00:00:00 2001 From: HichamELBSI Date: Fri, 28 May 2021 12:18:49 +0200 Subject: [PATCH] Fix PR review Signed-off-by: HichamELBSI --- .../admin/src/pages/EditSettingsView/reducer.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/core/content-manager/admin/src/pages/EditSettingsView/reducer.js b/packages/core/content-manager/admin/src/pages/EditSettingsView/reducer.js index 7e7740f336..3def54cfb8 100644 --- a/packages/core/content-manager/admin/src/pages/EditSettingsView/reducer.js +++ b/packages/core/content-manager/admin/src/pages/EditSettingsView/reducer.js @@ -20,22 +20,27 @@ const reducer = (state = initialState, action) => produce(state, draftState => { const layoutPathEdit = ['modifiedData', 'layouts', 'edit']; const layoutPathRelations = ['modifiedData', 'layouts', 'editRelations']; + switch (action.type) { case 'ADD_RELATION': { - const layoutFieldList = get(state, layoutPathRelations, []); - set(draftState, layoutPathRelations, [...layoutFieldList, action.name]); + const editRelationLayoutValue = get(state, layoutPathRelations, []); + set(draftState, layoutPathRelations, [...editRelationLayoutValue, action.name]); break; } case 'MOVE_RELATION': { - const layoutFieldList = get(state, layoutPathRelations, []); + const editRelationLayoutValue = get(state, layoutPathRelations, []); const { fromIndex, toIndex } = action; - set(draftState, layoutPathRelations, arrayMoveItem(layoutFieldList, fromIndex, toIndex)); + set( + draftState, + layoutPathRelations, + arrayMoveItem(editRelationLayoutValue, fromIndex, toIndex) + ); break; } case 'MOVE_ROW': { - const layoutFieldRowList = get(state, layoutPathEdit, []); + const editFieldLayoutValue = get(state, layoutPathEdit, []); const { fromIndex, toIndex } = action; - set(draftState, layoutPathEdit, arrayMoveItem(layoutFieldRowList, fromIndex, toIndex)); + set(draftState, layoutPathEdit, arrayMoveItem(editFieldLayoutValue, fromIndex, toIndex)); break; } case 'ON_ADD_FIELD': {