feat: enhance import session handling by adding session UUID to commitImport function
This commit is contained in:
@@ -143,7 +143,7 @@ describe('useImport', () => {
|
||||
await result.current.commit({ 'test.com': 'skip' })
|
||||
})
|
||||
|
||||
expect(api.commitImport).toHaveBeenCalledWith({ 'test.com': 'skip' })
|
||||
expect(api.commitImport).toHaveBeenCalledWith('session-2', { 'test.com': 'skip' })
|
||||
|
||||
await waitFor(() => {
|
||||
expect(result.current.session).toBeNull()
|
||||
|
||||
@@ -43,7 +43,11 @@ export function useImport() {
|
||||
});
|
||||
|
||||
const commitMutation = useMutation({
|
||||
mutationFn: (resolutions: Record<string, string>) => commitImport(resolutions),
|
||||
mutationFn: (resolutions: Record<string, string>) => {
|
||||
const sessionId = statusQuery.data?.session?.id;
|
||||
if (!sessionId) throw new Error("No active session");
|
||||
return commitImport(sessionId, resolutions);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: QUERY_KEY });
|
||||
queryClient.invalidateQueries({ queryKey: ['import-preview'] });
|
||||
|
||||
Reference in New Issue
Block a user