fix(store): guard abort on request supersession#313
Merged
Conversation
Add `abortable` utility to race promises against abort signals, ensuring guards and handlers reject immediately when superseded. Previously, guards that didn't check the abort signal could hang indefinitely when a request was superseded (e.g., rapid seek scrubbing). Behavior change: Abort errors now carry the original reason (SUPERSEDED, ABORTED) rather than always being ABORTED. This provides more accurate error information to callers.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
abortableutility to race promises against abort signalsabortableto ensure immediate rejection on supersessionProblem
Guards and handlers may not respect the abort signal. If a request is superseded while waiting in a guard (e.g., waiting for
canplay), the guard promise could hang forever:Solution
The
abortable(promise, signal)utility races any promise against an abort signal, guaranteeing immediate rejection regardless of whether the guard/handler implementation checks the signal.Behavior Change
Abort errors now carry the original reason (
SUPERSEDED,ABORTED) rather than always beingABORTED. This provides more accurate error information—callers can now distinguish "user cancelled" from "superseded by newer request."Test Plan
abortableutility