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