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 ), }; }