Skip to content

Commit

Permalink
How about we don't hold the entire image in memory (#2506)
Browse files Browse the repository at this point in the history
don't cache image upload chunks
  • Loading branch information
david-crespo authored Oct 16, 2024
1 parent 226d421 commit f7d6daf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/forms/image-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down

0 comments on commit f7d6daf

Please sign in to comment.