rm unused store

This commit is contained in:
Nikita Galaiko 2023-05-30 14:46:37 +02:00
parent a48e8e5db0
commit 3cf1532138

View File

@ -1,5 +1,4 @@
import { invoke, listen } from '$lib/ipc';
import { asyncWritable, type WritableLoadable } from '@square/svelte-store';
export type OperationDelete = { delete: [number, number] };
export type OperationInsert = { insert: [number, string] };
@ -32,21 +31,3 @@ export const subscribe = (
`project://${params.projectId}/sessions/${params.sessionId}/deltas`,
(event) => callback({ ...params, ...event.payload })
);
const stores: Record<string, Record<string, WritableLoadable<Record<string, Delta[]>>>> = {};
export const Deltas = (params: { projectId: string; sessionId: string }) => {
const projectStores = stores[params.projectId] || {};
if (params.sessionId in projectStores) return projectStores[params.sessionId];
const store = asyncWritable([], () => list(params));
subscribe(params, ({ filePath, deltas }) => {
store.update((deltasCache) => ({
...deltasCache,
[filePath]: deltas
}));
});
projectStores[params.sessionId] = store;
stores[params.projectId] = projectStores;
return store;
};