From e669e29be26875e74d0889614c7db44ca237bdbd Mon Sep 17 00:00:00 2001 From: David Crespo Date: Wed, 16 Oct 2024 11:32:56 -0500 Subject: [PATCH] don't cache image upload chunks --- app/forms/image-upload.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/forms/image-upload.tsx b/app/forms/image-upload.tsx index cba8df02d9..b7b7dbbbe8 100644 --- a/app/forms/image-upload.tsx +++ b/app/forms/image-upload.tsx @@ -215,7 +215,13 @@ export function CreateImageSideModalForm() { const createDisk = useApiMutation('diskCreate') const startImport = useApiMutation('diskBulkWriteImportStart') - const uploadChunk = useApiMutation('diskBulkWriteImport') + + // gcTime: 0 prevents the mutation cache from holding onto all the chunks for + // 5 minutes. It can be a ton of memory. To be honest, I don't even understand + // why the mutation cache exists. It's not like the query cache, which dedupes + // identical queries made around the same time. + // https://tanstack.com/query/v5/docs/reference/MutationCache + const uploadChunk = useApiMutation('diskBulkWriteImport', { gcTime: 0 }) // synthetic state for upload step because it consists of multiple requests const [syntheticUploadState, setSyntheticUploadState] =