From f15c8a4a5f9c458a634ac0c2d04acabb103da3fd Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Tue, 16 Jan 2024 13:24:46 -0600 Subject: [PATCH] Add dev-only debugging MoreComponents behavior --- src/photo/MorePhotosLarge.tsx | 6 ++++++ src/photo/index.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/photo/MorePhotosLarge.tsx b/src/photo/MorePhotosLarge.tsx index 1255092e..491975e5 100644 --- a/src/photo/MorePhotosLarge.tsx +++ b/src/photo/MorePhotosLarge.tsx @@ -19,6 +19,12 @@ export function MorePhotosLarge({ itemsPerRequest={itemsPerRequest} getNextComponent={async (offset, limit) => { 'use server'; + if ( + process.env.NODE_ENV === 'development' && + Math.random() < 0.95 + ) { + return { didFail: true }; + } const photos = await getPhotosCached({ limit: offset + limit }) .catch(() => undefined); if (!photos) { diff --git a/src/photo/index.ts b/src/photo/index.ts index a9d1c15e..a49e3751 100644 --- a/src/photo/index.ts +++ b/src/photo/index.ts @@ -11,7 +11,8 @@ import { import camelcaseKeys from 'camelcase-keys'; import type { Metadata } from 'next'; -export const LARGE_PHOTOS_TO_SHOW = 12; +export const LARGE_PHOTOS_TO_SHOW = + process.env.NODE_ENV === 'development' ? 2 : 12; export const GRID_THUMBNAILS_TO_SHOW_MAX = 12; export const ACCEPTED_PHOTO_FILE_TYPES = [