diff --git a/app/src/lib/backend/auth.ts b/app/src/lib/backend/auth.ts index 832955200..ba188bd0c 100644 --- a/app/src/lib/backend/auth.ts +++ b/app/src/lib/backend/auth.ts @@ -1,4 +1,4 @@ -import { invoke } from './ipc'; +import { invoke } from '$lib/backend/ipc'; export type GitCredentialCheck = { error?: string; diff --git a/app/src/lib/backend/gitConfigService.ts b/app/src/lib/backend/gitConfigService.ts index 3e8d678e3..dce50fd73 100644 --- a/app/src/lib/backend/gitConfigService.ts +++ b/app/src/lib/backend/gitConfigService.ts @@ -1,4 +1,4 @@ -import { invoke } from '@tauri-apps/api/tauri'; +import { invoke } from '$lib/backend/ipc'; export class GitConfigService { async get(key: string): Promise { diff --git a/app/src/lib/backend/ipc.ts b/app/src/lib/backend/ipc.ts index 64afe6c40..04bb6129d 100644 --- a/app/src/lib/backend/ipc.ts +++ b/app/src/lib/backend/ipc.ts @@ -1,6 +1,5 @@ import { listen as listenTauri } from '@tauri-apps/api/event'; import { invoke as invokeTauri } from '@tauri-apps/api/tauri'; -import { writable } from 'svelte/store'; import type { EventCallback, EventName } from '@tauri-apps/api/event'; export enum Code { @@ -31,26 +30,6 @@ export class UserError extends Error { } } -interface LoadItem { - name: string; - startedAt: Date; -} -const loadingStore = writable(false); -export const loadStack: LoadItem[] = []; -export const isLoading = { - ...loadingStore, - loadStack, - push: (item: LoadItem) => { - loadStack.push(item); - loadingStore.set(true); - }, - pop: (item: LoadItem) => { - const i = loadStack.indexOf(item); - loadStack.splice(i, 1); - if (loadStack.length == 0) loadingStore.set(false); - } -}; - export async function invoke(command: string, params: Record = {}): Promise { // This commented out code can be used to delay/reject an api call // return new Promise((resolve, reject) => { @@ -66,8 +45,6 @@ export async function invoke(command: string, params: Record // console.error(`ipc->${command}: ${JSON.stringify(params)}`, userError); // throw userError; // }); - const loadingItem = { name: command, startedAt: new Date() }; - isLoading.push(loadingItem); try { return await invokeTauri(command, params); @@ -75,8 +52,6 @@ export async function invoke(command: string, params: Record const userError = UserError.fromError(reason); console.error(`ipc->${command}: ${JSON.stringify(params)}`, userError, reason); throw userError; - } finally { - isLoading.pop(loadingItem); } } diff --git a/app/src/lib/vbranches/remoteCommits.ts b/app/src/lib/vbranches/remoteCommits.ts index b240c8f12..39a3abec2 100644 --- a/app/src/lib/vbranches/remoteCommits.ts +++ b/app/src/lib/vbranches/remoteCommits.ts @@ -3,8 +3,8 @@ * it's here is because the type is in this package. */ import { RemoteFile } from './types'; +import { invoke } from '$lib/backend/ipc'; import { ContentSection, HunkSection, parseFileSections } from '$lib/utils/fileSections'; -import { invoke } from '@tauri-apps/api/tauri'; import { plainToInstance } from 'class-transformer'; export async function listRemoteCommitFiles(projectId: string, commitOid: string) {