How about we don't hold the entire image in memory #2506
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Closes #2270
Reduce
gcTimeon upload chunk React Query mutation from default of 5 minutes to zero.As I say in the comment, I don't even understand why the mutation cache exists — it's not like we're reading from it. The query cache is a different story. So I don't see a downside to turning it off for this mutation. I have asked about in the Tanstack Discord and on Twitter, so I'll see if anything helpful comes out of that.
https://tanstack.com/query/v5/docs/reference/MutationCache
https://tanstack.com/query/v5/docs/framework/react/reference/useMutation
https://tkdodo.eu/blog/mastering-mutations-in-react-query
Before
Taking some snapshots in FF throughout a big upload. Memory goes up and up.
After
Memory fluctuates around a relatively small value, consistent with GC functioning as desired.
With shorter but non-zero
gcTimeAs a test, I set
gcTime: 60000(1 minute) and saw as expected that memory use still plateaus, but at a higher number because it holds onto everything it can process in one minute.