mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-27 08:36:24 +00:00
fix
This commit is contained in:
parent
de198ea025
commit
3cb3f565ac
3 changed files with 23 additions and 4 deletions
|
|
@ -101,6 +101,19 @@ export function SearchHistoryDialog() {
|
|||
setHistoryTasks((list) =>
|
||||
list.filter((item) => String(item.id) !== String(historyId))
|
||||
);
|
||||
|
||||
// If no remaining tasks share the same project, clean up project store
|
||||
if (history?.project_id) {
|
||||
const hasRemaining = historyTasks.some(
|
||||
(item) =>
|
||||
String(item.id) !== String(historyId) &&
|
||||
item.project_id === history.project_id
|
||||
);
|
||||
if (!hasRemaining) {
|
||||
projectStore.removeProject(history.project_id);
|
||||
}
|
||||
}
|
||||
|
||||
callback?.();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete history task:', error);
|
||||
|
|
|
|||
|
|
@ -52,10 +52,6 @@ export async function loginByStackToken(params: {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts a passwordless SSO login first, and auto-creates the user if not found.
|
||||
* This matches the UX request: “check existing profile; if missing, create like signup”.
|
||||
*/
|
||||
export function getLoginErrorMessage(
|
||||
data: any,
|
||||
fallbackCheckEmail: string,
|
||||
|
|
@ -89,6 +85,10 @@ export function getLoginErrorMessage(
|
|||
return data.text || fallbackGeneric;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts a passwordless SSO login first, and auto-creates the user if not found.
|
||||
* This matches the UX request: "check existing profile; if missing, create like signup".
|
||||
*/
|
||||
export async function loginByStackWithAutoCreate(
|
||||
token: string
|
||||
): Promise<StackLoginResponse> {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ vi.mock('react-router-dom', () => ({
|
|||
useNavigate: () => vi.fn(),
|
||||
}));
|
||||
|
||||
const removeProjectMock = vi.fn();
|
||||
vi.mock('@/hooks/useChatStoreAdapter', () => ({
|
||||
default: () => ({
|
||||
chatStore: { activeTaskId: undefined },
|
||||
|
|
@ -31,6 +32,7 @@ vi.mock('@/hooks/useChatStoreAdapter', () => ({
|
|||
getProjectById: vi.fn(() => null),
|
||||
setHistoryId: vi.fn(),
|
||||
setActiveProject: vi.fn(),
|
||||
removeProject: removeProjectMock,
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
|
@ -112,6 +114,7 @@ describe('SearchHistoryDialog', () => {
|
|||
(window as any).ipcRenderer = {
|
||||
invoke: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
vi.spyOn(window, 'confirm').mockReturnValue(true);
|
||||
});
|
||||
|
||||
it('deletes a history item from list view', async () => {
|
||||
|
|
@ -141,6 +144,9 @@ describe('SearchHistoryDialog', () => {
|
|||
'project-1'
|
||||
);
|
||||
|
||||
// Project store should be cleaned up since this was the last task in the project
|
||||
expect(removeProjectMock).toHaveBeenCalledWith('project-1');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByText('My history item')).not.toBeInTheDocument();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue