From 33902dbefe871f88d2e81543377e5f5386475670 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 3 Apr 2025 15:56:37 -0700 Subject: [PATCH] Make calendar window smaller to avoid tag limits --- src/app/components/CalendarEventForm.svelte | 2 +- src/app/requests.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/components/CalendarEventForm.svelte b/src/app/components/CalendarEventForm.svelte index 6ad412a3..f1146a0b 100644 --- a/src/app/components/CalendarEventForm.svelte +++ b/src/app/components/CalendarEventForm.svelte @@ -65,7 +65,7 @@ tags: [ ["d", initialValues?.d || randomId()], ["title", title], - ["location", location], + ["location", location || ""], ["start", start.toString()], ["end", end.toString()], ...daysBetween(start, end).map(D => ["D", D.toString()]), diff --git a/src/app/requests.ts b/src/app/requests.ts index bb5469ea..8c438f1b 100644 --- a/src/app/requests.ts +++ b/src/app/requests.ts @@ -8,7 +8,7 @@ import { uniq, int, YEAR, - MONTH, + DAY, insert, sortBy, assoc, @@ -203,9 +203,11 @@ export const makeCalendarFeed = ({ onExhausted?: () => void initialEvents?: TrustedEvent[] }) => { + const interval = int(5, DAY) + let exhaustedScrollers = 0 - let backwardWindow = [now() - MONTH, now()] - let forwardWindow = [now(), now() + MONTH] + let backwardWindow = [now() - interval, now()] + let forwardWindow = [now(), now() + interval] const getStart = (event: TrustedEvent) => parseInt(getTagValue("start", event.tags) || "") @@ -273,7 +275,7 @@ export const makeCalendarFeed = ({ onScroll: () => { const [since, until] = backwardWindow - backwardWindow = [since - MONTH, since] + backwardWindow = [since - interval, since] if (until > now() - int(2, YEAR)) { loadTimeframe(since, until) @@ -289,7 +291,7 @@ export const makeCalendarFeed = ({ onScroll: () => { const [since, until] = forwardWindow - forwardWindow = [until, until + MONTH] + forwardWindow = [until, until + interval] if (until < now() + int(2, YEAR)) { loadTimeframe(since, until)