diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 3cf7766..ebb0025 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -15,9 +15,16 @@ export async function load({ request, cookies, url }) {
throw error(403, "get a better user agent silly")
}
+ const lastVisitors = addLastVisitor(request, cookies)
+ let recentVisitCount = 0
+ for (const [_, visitor] of lastVisitors) {
+ recentVisitCount += visitor.visits.length
+ }
+
return {
route: url.pathname,
visitCount: incrementVisitCount(request, cookies),
- lastVisitors: addLastVisitor(request, cookies),
+ lastVisitors,
+ recentVisitCount,
}
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 848156b..fc68000 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -42,10 +42,6 @@
$: title = getTitle(data.route);
- $: recentVisitCount = data.lastVisitors.values().reduce(
- (total, visitor) => { return total + visitor.visits.length; }, 0
- )
-
const svgSquiggles = [[2], [3], [2], [3], [1]];
@@ -175,7 +171,7 @@