diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index f2cb652..c870855 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -2,7 +2,11 @@
import "./layout.css";
import favicon from "$lib/assets/favicon.svg";
import { ModeWatcher } from "mode-watcher";
- import { CalendarDate, today, getLocalTimeZone } from "@internationalized/date";
+ import {
+ CalendarDate,
+ today,
+ getLocalTimeZone,
+ } from "@internationalized/date";
import Header from "$lib/components/header.svelte";
import Calendar from "$lib/components/calendar.svelte";
@@ -11,27 +15,17 @@
let { children, data } = $props();
let dateValue = $derived(data.date);
- let entries = $derived(data.entries)
-
- // async function fetchForMonth(d: CalendarDate) {
- // const res = await fetch(
- // `/api/entry?month=${d.year}-${dateValue.month}`,
- // );
-
- // return await res.json()
- // }
+ let entries = $derived(data.entries);
- // onMount(async () => {
- // const res = await fetch(
- // `/api/entry?month=${dateValue.year}-${dateValue.month}`,
- // );
-
- // entries = await res.json()
- // });
-
$effect(() => {
- goto(`/${dateValue}`)
- })
+ // Navigate when dateValue changes
+ goto(`/${dateValue}`);
+ });
+
+ $effect(() => {
+ // Sync dateValue with data.date when it changes
+ dateValue = data.date;
+ });