From 7b0f1cbf2e6fe1ea5f6ea4800deaea173d64a711 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sat, 28 Jun 2025 11:58:06 +0700 Subject: [PATCH] feat: deleting integration your are currently on, should move you to global --- apps/frontend/src/components/new-launch/store.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/components/new-launch/store.ts b/apps/frontend/src/components/new-launch/store.ts index 8a5660c8..ec4b6c83 100644 --- a/apps/frontend/src/components/new-launch/store.ts +++ b/apps/frontend/src/components/new-launch/store.ts @@ -139,14 +139,17 @@ export const useLaunchStore = create()((set) => ({ settings: any ) => { set((state) => { - const existingIndex = state.selectedIntegrations.findIndex( + const existing = state.selectedIntegrations.find( (i) => i.integration.id === integration.id ); - if (existingIndex > -1) { + if (existing) { return { + ...(existing.integration.id === state.current + ? { current: 'global' } + : {}), selectedIntegrations: state.selectedIntegrations.filter( - (_, index) => index !== existingIndex + (s, index) => s.integration.id !== existing.integration.id ), }; }