Revalidate paths after individual upload adds

This commit is contained in:
Sam Becker 2025-07-06 11:27:36 -05:00
parent e50ecbf798
commit 2b54dd781c

View File

@ -99,6 +99,7 @@ const addUpload = async ({
takenAtNaiveLocal,
onStreamUpdate,
onFinish,
shouldRevalidateAllKeysAndPaths,
}:{
url: string
title?: string
@ -113,6 +114,7 @@ const addUpload = async ({
status?: UrlAddStatus['status'],
) => void
onFinish?: (url: string) => void
shouldRevalidateAllKeysAndPaths?: boolean
}) => {
const {
formDataFromExif,
@ -171,6 +173,9 @@ const addUpload = async ({
await convertFormDataToPhotoDbInsertAndLookupRecipeTitle(form);
photo.url = updatedUrl;
await insertPhoto(photo);
if (shouldRevalidateAllKeysAndPaths) {
after(revalidateAllKeysAndPaths);
}
onFinish?.(url);
// Re-submit with updated url
onStreamUpdate?.(subheadFinal, 'added');