From 84587b4b83c752a0f6f08c7bc44642ac612589b6 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 13 Jul 2025 11:31:33 -0500 Subject: [PATCH] Make sidebar photo count accurate --- app/grid/[sortType]/[sortOrder]/page.tsx | 5 +++++ app/grid/page.tsx | 5 +++++ app/page.tsx | 5 +++++ src/photo/PhotoGridPageClient.tsx | 4 +++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/grid/[sortType]/[sortOrder]/page.tsx b/app/grid/[sortType]/[sortOrder]/page.tsx index 5b1e3578..0a4f4963 100644 --- a/app/grid/[sortType]/[sortOrder]/page.tsx +++ b/app/grid/[sortType]/[sortOrder]/page.tsx @@ -33,6 +33,7 @@ export default async function GridPage({ params }: SortProps) { const [ photos, photosCount, + photosCountWithExcludes, categories, ] = await Promise.all([ getPhotosCached(sortOptions) @@ -40,6 +41,9 @@ export default async function GridPage({ params }: SortProps) { getPhotosMetaCached(FEED_META_QUERY_OPTIONS) .then(({ count }) => count) .catch(() => 0), + getPhotosMetaCached() + .then(({ count }) => count) + .catch(() => 0), getDataForCategoriesCached(), ]); @@ -49,6 +53,7 @@ export default async function GridPage({ params }: SortProps) { {...{ photos, photosCount, + photosCountWithExcludes, ...sortOptions, ...categories, }} diff --git a/app/grid/page.tsx b/app/grid/page.tsx index 331e39ef..8f59e512 100644 --- a/app/grid/page.tsx +++ b/app/grid/page.tsx @@ -26,6 +26,7 @@ export default async function GridPage() { const [ photos, photosCount, + photosCountWithExcludes, categories, ] = await Promise.all([ getPhotosCached() @@ -33,6 +34,9 @@ export default async function GridPage() { getPhotosMetaCached(FEED_META_QUERY_OPTIONS) .then(({ count }) => count) .catch(() => 0), + getPhotosMetaCached() + .then(({ count }) => count) + .catch(() => 0), getDataForCategoriesCached(), ]); @@ -42,6 +46,7 @@ export default async function GridPage() { {...{ photos, photosCount, + photosCountWithExcludes, ...USER_DEFAULT_SORT_OPTIONS, ...categories, }} diff --git a/app/page.tsx b/app/page.tsx index 77cb5f6d..9711ae98 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -28,6 +28,7 @@ export default async function HomePage() { const [ photos, photosCount, + photosCountWithExcludes, categories, ] = await Promise.all([ getPhotosCached() @@ -35,6 +36,9 @@ export default async function HomePage() { getPhotosMetaCached(FEED_META_QUERY_OPTIONS) .then(({ count }) => count) .catch(() => 0), + getPhotosMetaCached() + .then(({ count }) => count) + .catch(() => 0), GRID_HOMEPAGE_ENABLED ? getDataForCategoriesCached() : NULL_CATEGORY_DATA, @@ -47,6 +51,7 @@ export default async function HomePage() { {...{ photos, photosCount, + photosCountWithExcludes, ...USER_DEFAULT_SORT_OPTIONS, ...categories, }} diff --git a/src/photo/PhotoGridPageClient.tsx b/src/photo/PhotoGridPageClient.tsx index a2b765aa..7d9cc4dd 100644 --- a/src/photo/PhotoGridPageClient.tsx +++ b/src/photo/PhotoGridPageClient.tsx @@ -15,12 +15,14 @@ import { SortBy } from './db/sort'; export default function PhotoGridPageClient({ photos, photosCount, + photosCountWithExcludes, sortBy, sortWithPriority, ...categories }: ComponentProps & { photos: Photo[] photosCount: number + photosCountWithExcludes: number sortBy: SortBy sortWithPriority: boolean }) { @@ -58,7 +60,7 @@ export default function PhotoGridPageClient({ >