Revert "warm up the cache on mount"

This reverts commit 20c03d6e96.
This commit is contained in:
Kiril Videlov 2023-03-28 17:00:25 +02:00 committed by Kiril Videlov
parent b3e4ec151e
commit 00bb8e39aa
2 changed files with 2 additions and 13 deletions

View File

@ -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) =>

View File

@ -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>