diff options
author | dan <dan.abramov@gmail.com> | 2024-10-03 11:41:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-03 11:41:23 +0900 |
commit | d2392d2d64c46d0fd0b6d97b3b4715b5b8c825d3 (patch) | |
tree | 6c5aaa7e42f6543112140464d084db14b4495987 /src/lib/api/index.ts | |
parent | c2dac855cc61e05d21b7dbb81f1fef26f1a9e1e7 (diff) | |
download | voidsky-d2392d2d64c46d0fd0b6d97b3b4715b5b8c825d3.tar.zst |
Refactor video uploads (#5570)
* Remove unused video field * Stop exposing video dispatch * Move cancellation out of the reducer * Make useUploadStatusQuery controlled by jobId * Rename SetStatus to SetProcessing This action only has one callsite and it's always passing "processing". * Move jobId into video reducer state * Make cancellation scoped * Inline useCompressVideoMutation * Move processVideo down the file * Extract getErrorMessage * useServiceAuthToken -> getServiceAuthToken * useVideoAgent -> createVideoAgent * useVideoUploadLimits -> getVideoUploadLimits * useUploadVideoMutation -> uploadVideo * Use async/await in processVideo * Inline onVideoCompressed into processVideo * Use async/await for uploadVideo * Factor out error messages * Guard dispatch with signal This lets us remove the scattered signal checks around dispatch. * Move job polling out of RQ * Handle poll failures * Remove unnecessary guards * Slightly more accurate condition * Move initVideoUri handling out of the hook * Remove dead argument It wasn't being used before either. * Remove unused detailed status This isn't being used because we're only respecting that state variable when isProcessing=true, but isProcessing is always false during video upload. If we want to re-add this later, it should really just be derived from the reducer state. * Harden the video reducer * Tie all spawned work to a signal * Preserve asset/media for nicer error state * Rename actions to match states * Inline useUploadVideo This abstraction is getting in the way of some future work. * Move MIME check to the only place that handles it
Diffstat (limited to 'src/lib/api/index.ts')
0 files changed, 0 insertions, 0 deletions