fix(context): clear switch state on direct ssh reset
This commit is contained in:
parent
c04a259cea
commit
d32db985b5
2 changed files with 12 additions and 0 deletions
|
|
@ -103,6 +103,8 @@ export const createConnectionSlice: StateCreator<AppState, [], [], ConnectionSli
|
||||||
},
|
},
|
||||||
...getFullResetState(),
|
...getFullResetState(),
|
||||||
...getContextScopedTeamResetState(),
|
...getContextScopedTeamResetState(),
|
||||||
|
isContextSwitching: false,
|
||||||
|
targetContextId: null,
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
});
|
});
|
||||||
|
|
@ -165,6 +167,8 @@ export const createConnectionSlice: StateCreator<AppState, [], [], ConnectionSli
|
||||||
},
|
},
|
||||||
...getFullResetState(),
|
...getFullResetState(),
|
||||||
...getContextScopedTeamResetState(),
|
...getContextScopedTeamResetState(),
|
||||||
|
isContextSwitching: false,
|
||||||
|
targetContextId: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Re-fetch local data
|
// Re-fetch local data
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,8 @@ describe('context slice team/task reset', () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
globalTasksInitialized: true,
|
globalTasksInitialized: true,
|
||||||
|
isContextSwitching: true,
|
||||||
|
targetContextId: 'local',
|
||||||
} as never);
|
} as never);
|
||||||
|
|
||||||
await store.getState().connectSsh({
|
await store.getState().connectSsh({
|
||||||
|
|
@ -366,6 +368,8 @@ describe('context slice team/task reset', () => {
|
||||||
expect(store.getState().teams).toEqual([]);
|
expect(store.getState().teams).toEqual([]);
|
||||||
expect(store.getState().teamByName).toEqual({});
|
expect(store.getState().teamByName).toEqual({});
|
||||||
expect(store.getState().globalTasks).toEqual([]);
|
expect(store.getState().globalTasks).toEqual([]);
|
||||||
|
expect(store.getState().isContextSwitching).toBe(false);
|
||||||
|
expect(store.getState().targetContextId).toBeNull();
|
||||||
expect(apiMock.teams.list).toHaveBeenCalledTimes(1);
|
expect(apiMock.teams.list).toHaveBeenCalledTimes(1);
|
||||||
expect(apiMock.teams.getAllTasks).toHaveBeenCalledTimes(1);
|
expect(apiMock.teams.getAllTasks).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
@ -400,6 +404,8 @@ describe('context slice team/task reset', () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
globalTasksInitialized: true,
|
globalTasksInitialized: true,
|
||||||
|
isContextSwitching: true,
|
||||||
|
targetContextId: 'local',
|
||||||
} as never);
|
} as never);
|
||||||
|
|
||||||
await store.getState().disconnectSsh();
|
await store.getState().disconnectSsh();
|
||||||
|
|
@ -408,6 +414,8 @@ describe('context slice team/task reset', () => {
|
||||||
expect(store.getState().teams).toEqual([]);
|
expect(store.getState().teams).toEqual([]);
|
||||||
expect(store.getState().teamByName).toEqual({});
|
expect(store.getState().teamByName).toEqual({});
|
||||||
expect(store.getState().globalTasks).toEqual([]);
|
expect(store.getState().globalTasks).toEqual([]);
|
||||||
|
expect(store.getState().isContextSwitching).toBe(false);
|
||||||
|
expect(store.getState().targetContextId).toBeNull();
|
||||||
expect(apiMock.teams.list).toHaveBeenCalledTimes(1);
|
expect(apiMock.teams.list).toHaveBeenCalledTimes(1);
|
||||||
expect(apiMock.teams.getAllTasks).toHaveBeenCalledTimes(1);
|
expect(apiMock.teams.getAllTasks).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue