From 3a0a7b4cda8137158c02f334ae680af07a41197b Mon Sep 17 00:00:00 2001 From: Abishek Raj R R Date: Fri, 27 Feb 2026 15:02:53 +0530 Subject: [PATCH] fix(uikit-playground): fix project and screen state update after deletion --- apps/uikit-playground/src/Context/reducer.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/uikit-playground/src/Context/reducer.ts b/apps/uikit-playground/src/Context/reducer.ts index af111090f5275..7d135d71d6b72 100644 --- a/apps/uikit-playground/src/Context/reducer.ts +++ b/apps/uikit-playground/src/Context/reducer.ts @@ -202,16 +202,6 @@ const reducer = (state: initialStateType, action: IAction) => { (id) => id !== action.payload ), ]; - if (state.projects[activeProject].screens.length > 0) { - state.activeScreen = state.projects[activeProject].screens[0]; - } else if (state.projects[activeProject].screens.length === 0) { - if (Object.keys(state.projects).length > 0) { - delete state.projects[activeProject]; - state.activeProject = ''; - state.activeScreen = ''; - } - } - state.projects[activeProject].flowEdges = state.projects[ activeProject ].flowEdges.filter( @@ -223,6 +213,14 @@ const reducer = (state: initialStateType, action: IAction) => { activeProject ].flowNodes.filter((node) => node.id !== action.payload); + if (state.projects[activeProject].screens.length > 0) { + state.activeScreen = state.projects[activeProject].screens[0]; + } else { + delete state.projects[activeProject]; + state.activeProject = ''; + state.activeScreen = ''; + } + return { ...state }; }