Skip to content

Commit 8f790bf

Browse files
authored
feat(sync): support offline commit- [INS-4226] (#7811)
* feat(sync): support offline commit
1 parent 9f24405 commit 8f790bf

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export const SyncDropdown: FC<Props> = ({ gitSyncEnabled }) => {
9090
historyCount: 0,
9191
history: [],
9292
syncItems: [],
93-
remoteBackendProjects: [],
9493
compare: { ahead: 0, behind: 0 },
9594
};
9695

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ interface SyncData {
254254
ahead: number;
255255
behind: number;
256256
};
257-
remoteBackendProjects: BackendProject[];
258257
}
259258

260259
const remoteBranchesCache: Record<string, string[]> = {};
@@ -320,27 +319,31 @@ export const syncDataLoader: LoaderFunction = async ({
320319
const vcs = VCSInstance();
321320
const { syncItems } = await getSyncItems({ workspaceId });
322321
const localBranches = (await vcs.getBranchNames()).sort();
323-
const remoteBranches = (
324-
remoteBranchesCache[workspaceId] || (await vcs.getRemoteBranchNames())
325-
).sort();
326322
const currentBranch = await vcs.getCurrentBranchName();
327323
const history = (await vcs.getHistory()).sort((a, b) =>
328324
b.created > a.created ? 1 : -1
329325
);
330326
const historyCount = await vcs.getHistoryCount();
331327
const status = await vcs.status(syncItems);
332-
const compare =
328+
329+
let remoteBranches: string[] = [];
330+
let compare = { ahead: 0, behind: 0 };
331+
try {
332+
remoteBranches = (
333+
remoteBranchesCache[workspaceId] || (await vcs.getRemoteBranchNames())
334+
).sort();
335+
compare =
333336
remoteCompareCache[workspaceId] || (await vcs.compareRemoteBranch());
334337
const remoteBackendProjects =
335338
remoteBackendProjectsCache[workspaceId] ||
336339
(await vcs.remoteBackendProjects({
337340
teamId: project.parentId,
338341
teamProjectId: project.remoteId,
339342
}));
340-
341343
remoteBranchesCache[workspaceId] = remoteBranches;
342344
remoteCompareCache[workspaceId] = compare;
343345
remoteBackendProjectsCache[workspaceId] = remoteBackendProjects;
346+
} catch (e) { }
344347

345348
return {
346349
syncItems,
@@ -351,7 +354,6 @@ export const syncDataLoader: LoaderFunction = async ({
351354
historyCount,
352355
status,
353356
compare,
354-
remoteBackendProjects,
355357
};
356358
} catch (e) {
357359
const errorMessage =

0 commit comments

Comments
 (0)