diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 974b17285..56fdd34a8 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2432,9 +2432,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.45" +version = "0.10.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" dependencies = [ "bitflags", "cfg-if", @@ -2473,9 +2473,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.80" +version = "0.9.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" dependencies = [ "autocfg", "cc", diff --git a/src/app.postcss b/src/app.postcss index 0013c1e82..2e73c9a0a 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -3,12 +3,6 @@ @tailwind components; @tailwind utilities; -/* this is trick to make webkit use hardware acceleration */ -*:not(html) { - -webkit-transform: translate3d(0, 0, 0); - -webkit-perspective: 1000; -} - /* SCROLL BAR STYLING */ /* width */ diff --git a/src/lib/deltas.ts b/src/lib/deltas.ts index 7d3a904e2..25baa2197 100644 --- a/src/lib/deltas.ts +++ b/src/lib/deltas.ts @@ -23,32 +23,8 @@ export type DeltasEvent = { filePath: string; }; -const cache: Record>>> = {}; - -export const list = async (params: { projectId: string; sessionId: string; paths?: string[] }) => { - const sessionCache = cache[params.projectId] || {}; - if (params.sessionId in sessionCache) { - return sessionCache[params.sessionId].then((deltas) => - Object.fromEntries( - Object.entries(deltas).filter(([path]) => - params.paths ? params.paths.includes(path) : true - ) - ) - ); - } - - const promise = invoke>('list_deltas', { - projectId: params.projectId, - sessionId: params.sessionId - }); - sessionCache[params.sessionId] = promise; - cache[params.projectId] = sessionCache; - return promise.then((deltas) => - Object.fromEntries( - Object.entries(deltas).filter(([path]) => (params.paths ? params.paths.includes(path) : true)) - ) - ); -}; +export const list = async (params: { projectId: string; sessionId: string; paths?: string[] }) => + invoke>('list_deltas', params); export const subscribe = ( params: { projectId: string; sessionId: string }, diff --git a/src/lib/sessions.ts b/src/lib/sessions.ts index 26b37ef9f..147cc3021 100644 --- a/src/lib/sessions.ts +++ b/src/lib/sessions.ts @@ -62,7 +62,7 @@ export const listFiles = async (params: { const sessionsCache: Record> = {}; -const list = async (params: { projectId: string; earliestTimestampMs?: number }) => { +export const list = async (params: { projectId: string; earliestTimestampMs?: number }) => { if (params.projectId in sessionsCache) { return sessionsCache[params.projectId].then((sessions) => sessions.filter((s) => diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index ddaf41cd7..1d13d0fe3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,10 +4,11 @@ import { Toaster } from 'svelte-french-toast'; import type { LayoutData } from './$types'; import { BackForwardButtons } from '$lib/components'; - import { setContext } from 'svelte'; + import { onMount, 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; @@ -16,6 +17,16 @@ 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); diff --git a/src/routes/projects/[projectId]/player/[date]/+layout.svelte b/src/routes/projects/[projectId]/player/[date]/+layout.svelte index b2ae867bb..d2a2c12b2 100644 --- a/src/routes/projects/[projectId]/player/[date]/+layout.svelte +++ b/src/routes/projects/[projectId]/player/[date]/+layout.svelte @@ -1,5 +1,7 @@ -{#if $sessions.length === 0} -
-

I haven't seen any changes yet

-

Go code something!

-
-{:else} - {#if $fileFilter} - - {$fileFilter} - +{#await dates.load() then} + {#if $sessions.length === 0} +
+

I haven't seen any changes yet

+

Go code something!

+
+ {:else} + {#if $fileFilter} + + {$fileFilter} + + {/if} + +
+ + + +
{/if} - -
- - - -
-{/if} +{/await} diff --git a/src/routes/projects/[projectId]/player/[date]/[sessionId]/+page.svelte b/src/routes/projects/[projectId]/player/[date]/[sessionId]/+page.svelte index 800879bc1..413cca52b 100644 --- a/src/routes/projects/[projectId]/player/[date]/[sessionId]/+page.svelte +++ b/src/routes/projects/[projectId]/player/[date]/[sessionId]/+page.svelte @@ -271,7 +271,7 @@
{#if $frame}
@@ -298,14 +298,7 @@