Skip to content

Commit 43edf39

Browse files
authored
fix updates to db leading to errors in loader fetchers (#7033)
1 parent a09c233 commit 43edf39

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

packages/insomnia/src/ui/components/dropdowns/sync-dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ export const SyncDropdown: FC<Props> = ({ gitSyncEnabled }) => {
205205
},
206206
{
207207
id: 'revert',
208-
name: 'Revert to latest commit',
208+
name: 'Discard all changes',
209209
icon: 'undo',
210-
isDisabled: historyCount === 0 || rollbackFetcher.state !== 'idle',
210+
isDisabled: historyCount === 0 || rollbackFetcher.state !== 'idle' || !canCreateSnapshot,
211211
action: () => {
212212
rollbackFetcher.submit({}, {
213213
method: 'POST',

packages/insomnia/src/ui/routes/remote-collections.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export const createBranchAction: ActionFunction = async ({ request, params }) =>
339339
};
340340

341341
export const deleteBranchAction: ActionFunction = async ({ params, request }) => {
342-
const { workspaceId } = params;
342+
const { organizationId, projectId, workspaceId } = params;
343343
invariant(typeof workspaceId === 'string', 'Workspace Id is required');
344344
const formData = await request.formData();
345345
const branch = formData.get('branch');
@@ -362,11 +362,11 @@ export const deleteBranchAction: ActionFunction = async ({ params, request }) =>
362362
};
363363
}
364364

365-
return null;
365+
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug`);
366366
};
367367

368368
export const pullFromRemoteAction: ActionFunction = async ({ params }) => {
369-
const { projectId, workspaceId } = params;
369+
const { organizationId, projectId, workspaceId } = params;
370370
invariant(typeof projectId === 'string', 'Project Id is required');
371371
invariant(typeof workspaceId === 'string', 'Workspace Id is required');
372372
const project = await models.project.getById(projectId);
@@ -386,7 +386,7 @@ export const pullFromRemoteAction: ActionFunction = async ({ params }) => {
386386
};
387387
}
388388

389-
return null;
389+
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug`);
390390
};
391391

392392
export const fetchRemoteBranchAction: ActionFunction = async ({ request, params }) => {
@@ -449,25 +449,26 @@ export const pushToRemoteAction: ActionFunction = async ({ params }) => {
449449
};
450450

451451
export const rollbackChangesAction: ActionFunction = async ({ params }) => {
452-
const { workspaceId } = params;
452+
const { organizationId, projectId, workspaceId } = params;
453453
invariant(typeof workspaceId === 'string', 'Workspace Id is required');
454454
try {
455455
const vcs = VCSInstance();
456456
const { syncItems } = await getSyncItems({ workspaceId });
457457
const delta = await vcs.rollbackToLatest(syncItems);
458458
await database.batchModifyDocs(delta as unknown as Operation);
459459
delete remoteCompareCache[workspaceId];
460-
return {};
461460
} catch (err) {
462461
const errorMessage = err instanceof Error ? err.message : 'Unknown error while rolling back changes.';
463462
return {
464463
error: errorMessage,
465464
};
466465
}
466+
467+
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug`);
467468
};
468469

469470
export const restoreChangesAction: ActionFunction = async ({ request, params }) => {
470-
const { workspaceId } = params;
471+
const { organizationId, projectId, workspaceId } = params;
471472
invariant(typeof workspaceId === 'string', 'Workspace Id is required');
472473
const formData = await request.formData();
473474
const id = formData.get('id');
@@ -485,7 +486,7 @@ export const restoreChangesAction: ActionFunction = async ({ request, params })
485486
};
486487
}
487488

488-
return null;
489+
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug`);
489490
};
490491

491492
export const createSnapshotAction: ActionFunction = async ({ request, params }) => {

0 commit comments

Comments
 (0)