From 2db9355b7b4c48e17879de5fe3376f29b8db9cfe Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 8 Jun 2026 20:22:40 +0530 Subject: [PATCH] fix: Accept time:0 entries and precompute history entry URLs Code-review follow-ups: - validateEntry no longer rejects entries whose time is 0 (epoch); it now checks `typeof time === 'number'`, so restoring/uploading such entries works instead of silently dropping them. - History.svelte serializes each entry's "open in new tab" URL once via a $derived list instead of calling serializeState (pako deflate) per row on every render. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/components/History/History.svelte | 11 ++++++++--- src/lib/components/History/historyState.svelte.ts | 2 +- src/lib/components/History/historyState.test.ts | 9 +++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/components/History/History.svelte b/src/lib/components/History/History.svelte index 444cb294..293fdbfe 100644 --- a/src/lib/components/History/History.svelte +++ b/src/lib/components/History/History.svelte @@ -105,6 +105,11 @@ // Absolute editor URL for an entry, so the link can be opened in a new tab or copied. const entryUrl = (state: State): string => `${window.location.origin}${window.location.pathname}#${serializeState(state)}`; + + // Serialize each entry's URL once per change rather than per row on every render. + const entriesWithUrl = $derived( + historyState.entries.map((entry) => ({ ...entry, openUrl: entryUrl(entry.state) })) + ); @@ -143,8 +148,8 @@ {/snippet}
    - {#if historyState.entries.length > 0} - {#each historyState.entries as { id, state, time, name, url, type } (id)} + {#if entriesWithUrl.length > 0} + {#each entriesWithUrl as { id, state, time, name, url, type, openUrl } (id)}
  • @@ -167,7 +172,7 @@ {dayjs(time).fromNow()}