diff --git a/packages/backend/src/registries/LocalRepositoryRegistry.spec.ts b/packages/backend/src/registries/LocalRepositoryRegistry.spec.ts index c2f511e04..39e0bd3ff 100644 --- a/packages/backend/src/registries/LocalRepositoryRegistry.spec.ts +++ b/packages/backend/src/registries/LocalRepositoryRegistry.spec.ts @@ -49,10 +49,10 @@ test('should notify webview when register', () => { const localRepositories = new LocalRepositoryRegistry({ postMessage: mocks.postMessageMock, } as unknown as Webview); - localRepositories.register({path: 'random', recipeId: 'random'}); + localRepositories.register({ path: 'random', recipeId: 'random' }); expect(mocks.postMessageMock).toHaveBeenNthCalledWith(1, { id: MSG_LOCAL_REPOSITORY_UPDATE, - body: [{path: 'random', recipeId: 'random'}], + body: [{ path: 'random', recipeId: 'random' }], }); }); @@ -60,7 +60,7 @@ test('should notify webview when unregister', () => { const localRepositories = new LocalRepositoryRegistry({ postMessage: mocks.postMessageMock, } as unknown as Webview); - localRepositories.register({path: 'random', recipeId: 'random'}); + localRepositories.register({ path: 'random', recipeId: 'random' }); localRepositories.unregister('random'); expect(mocks.postMessageMock).toHaveBeenLastCalledWith({ diff --git a/packages/backend/src/registries/LocalRepositoryRegistry.ts b/packages/backend/src/registries/LocalRepositoryRegistry.ts index 7bea32538..407c8d64e 100644 --- a/packages/backend/src/registries/LocalRepositoryRegistry.ts +++ b/packages/backend/src/registries/LocalRepositoryRegistry.ts @@ -48,11 +48,13 @@ export class LocalRepositoryRegistry { } private notify() { - this.webview.postMessage({ - id: MSG_LOCAL_REPOSITORY_UPDATE, - body: this.getLocalRepositories(), - }).catch((err: unknown) => { - console.error('Something went wrong while notifying local repositories update', err); - }); + this.webview + .postMessage({ + id: MSG_LOCAL_REPOSITORY_UPDATE, + body: this.getLocalRepositories(), + }) + .catch((err: unknown) => { + console.error('Something went wrong while notifying local repositories update', err); + }); } } diff --git a/packages/frontend/src/stores/localRepositories.ts b/packages/frontend/src/stores/localRepositories.ts index b1289dc1b..379734831 100644 --- a/packages/frontend/src/stores/localRepositories.ts +++ b/packages/frontend/src/stores/localRepositories.ts @@ -4,18 +4,15 @@ import { MSG_LOCAL_REPOSITORY_UPDATE, MSG_NEW_RECIPE_STATE } from '@shared/Messa import { rpcBrowser, studioClient } from '/@/utils/client'; import type { LocalRepository } from '@shared/src/models/ILocalRepository'; -export const localRepositories: Readable = readable( - [], - set => { - const sub = rpcBrowser.subscribe(MSG_LOCAL_REPOSITORY_UPDATE, msg => { - set(msg); - }); - // Initialize the store manually - studioClient.getLocalRepositories().then(state => { - set(state); - }); - return () => { - sub.unsubscribe(); - }; - }, -); +export const localRepositories: Readable = readable([], set => { + const sub = rpcBrowser.subscribe(MSG_LOCAL_REPOSITORY_UPDATE, msg => { + set(msg); + }); + // Initialize the store manually + studioClient.getLocalRepositories().then(state => { + set(state); + }); + return () => { + sub.unsubscribe(); + }; +});