mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 17:43:47 +03:00
rm unused store
This commit is contained in:
parent
a48e8e5db0
commit
3cf1532138
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user