Make sidebar photo count accurate

This commit is contained in:
Sam Becker 2025-07-13 11:31:33 -05:00
parent 54abdce4df
commit 84587b4b83
4 changed files with 18 additions and 1 deletions

View File

@ -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,
}}

View File

@ -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,
}}

View File

@ -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,
}}

View File

@ -15,12 +15,14 @@ import { SortBy } from './db/sort';
export default function PhotoGridPageClient({
photos,
photosCount,
photosCountWithExcludes,
sortBy,
sortWithPriority,
...categories
}: ComponentProps<typeof PhotoGridSidebar> & {
photos: Photo[]
photosCount: number
photosCountWithExcludes: number
sortBy: SortBy
sortWithPriority: boolean
}) {
@ -58,7 +60,7 @@ export default function PhotoGridPageClient({
>
<PhotoGridSidebar {...{
...categories,
photosCount,
photosCount: photosCountWithExcludes,
containerHeight,
}} />
</MaskedScroll>