From d5809547eabc6455b1206cbb5d7633a9750816de Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 21 Feb 2026 23:23:01 -0600 Subject: [PATCH] Prevent toasts for color data changes --- src/photo/form/PhotoForm.tsx | 7 +++++-- src/photo/form/index.ts | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/photo/form/PhotoForm.tsx b/src/photo/form/PhotoForm.tsx index 59d3422d..3f05f5f7 100644 --- a/src/photo/form/PhotoForm.tsx +++ b/src/photo/form/PhotoForm.tsx @@ -10,6 +10,7 @@ import { useState, } from 'react'; import { + FIELDS_TO_NOT_TOAST, FIELDS_WITH_JSON, FORM_METADATA_ENTRIES_BY_SECTION, FORM_SECTIONS, @@ -184,8 +185,10 @@ export default function PhotoForm({ setDetectedFilm(updatedExifData.film); } - if (changedKeys.length > 0) { - const fields = convertFormKeysToLabels(changedKeys); + const keysToToast = changedKeys.filter(key => + !FIELDS_TO_NOT_TOAST.includes(key)); + if (keysToToast.length > 0) { + const fields = convertFormKeysToLabels(keysToToast); toastSuccess(`Updated EXIF fields: ${fields.join(', ')}`, 8000); } else { toastWarning('No new EXIF data found'); diff --git a/src/photo/form/index.ts b/src/photo/form/index.ts index 4cfb744a..a1fded06 100644 --- a/src/photo/form/index.ts +++ b/src/photo/form/index.ts @@ -291,6 +291,11 @@ const FORM_METADATA = ( }, }); +export const FIELDS_TO_NOT_TOAST: (keyof PhotoFormData)[] = [ + 'colorData', + 'colorSort', +]; + export const FIELDS_WITH_JSON = Object.entries(FORM_METADATA()) .filter(([_, meta]) => meta.isJson) .map(([key]) => key as keyof PhotoFormData);