mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-24 05:29:51 +03:00
parent
b3e4ec151e
commit
00bb8e39aa
@ -62,7 +62,7 @@ export const listFiles = async (params: {
|
||||
|
||||
const sessionsCache: Record<string, Promise<Session[]>> = {};
|
||||
|
||||
export const list = async (params: { projectId: string; earliestTimestampMs?: number }) => {
|
||||
const list = async (params: { projectId: string; earliestTimestampMs?: number }) => {
|
||||
if (params.projectId in sessionsCache) {
|
||||
return sessionsCache[params.projectId].then((sessions) =>
|
||||
sessions.filter((s) =>
|
||||
|
@ -4,11 +4,10 @@
|
||||
import { Toaster } from 'svelte-french-toast';
|
||||
import type { LayoutData } from './$types';
|
||||
import { BackForwardButtons } from '$lib/components';
|
||||
import { onMount, setContext } from 'svelte';
|
||||
import { setContext } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
import Breadcrumbs from '$lib/components/Breadcrumbs.svelte';
|
||||
import CommandPalette from '$lib/components/CommandPalette';
|
||||
import { list as listSessions, listFiles } from '$lib/sessions';
|
||||
|
||||
export let data: LayoutData;
|
||||
const { user, posthog, projects } = data;
|
||||
@ -17,16 +16,6 @@
|
||||
setContext('session', writable(null));
|
||||
setContext('projects', projects);
|
||||
|
||||
onMount(() =>
|
||||
// warm up the cache
|
||||
$projects.forEach(async (project) => {
|
||||
const sessions = await listSessions({ projectId: project.id });
|
||||
sessions.forEach(async (session) => {
|
||||
listFiles({ projectId: project.id, sessionId: session.id });
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
user.subscribe(posthog.identify);
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user