Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: deleting integration your are currently on, should move you to global

Nevo David7b0f1cbf2e6f
diff --git a/apps/frontend/src/components/new-launch/store.ts b/apps/frontend/src/components/new-launch/store.ts
index 8a5660c88..ec4b6c83b 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<StoreState>()((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
),
};
}