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

This commit is contained in:
Nevo David 2025-06-28 11:58:06 +07:00
parent 69a08e6c8c
commit 7b0f1cbf2e
1 changed files with 6 additions and 3 deletions

View File

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