Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement Flight CacheSignal
Notably this is currently always creating a new signal rather than passing
the one you pass into the Web Streams APIs.

It might be better ot pass the original one through so that it can contain
other information such as TaskSignal to handle priorities. However, I'm not
sure if we'd want to wrap it with our own TaskSignal yet.
  • Loading branch information
sebmarkbage committed Jun 17, 2025
commit 4eab1caf10957e7f9712a36cbefcb54d363441b5
7 changes: 5 additions & 2 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export type Request = {
destination: null | Destination,
bundlerConfig: ClientManifest,
cache: Map<Function, mixed>,
cacheController: AbortController,
nextChunkId: number,
pendingChunks: number,
hints: Hints,
Expand Down Expand Up @@ -529,6 +530,7 @@ function RequestInstance(
this.destination = null;
this.bundlerConfig = bundlerConfig;
this.cache = new Map();
this.cacheController = new AbortController();
this.nextChunkId = 0;
this.pendingChunks = 0;
this.hints = hints;
Expand Down Expand Up @@ -604,7 +606,7 @@ export function createRequest(
model: ReactClientValue,
bundlerConfig: ClientManifest,
onError: void | ((error: mixed) => ?string),
identifierPrefix?: string,
identifierPrefix: void | string,
onPostpone: void | ((reason: string) => void),
temporaryReferences: void | TemporaryReferenceSet,
environmentName: void | string | (() => string), // DEV-only
Expand Down Expand Up @@ -636,7 +638,7 @@ export function createPrerenderRequest(
onAllReady: () => void,
onFatalError: () => void,
onError: void | ((error: mixed) => ?string),
identifierPrefix?: string,
identifierPrefix: void | string,
onPostpone: void | ((reason: string) => void),
temporaryReferences: void | TemporaryReferenceSet,
environmentName: void | string | (() => string), // DEV-only
Expand Down Expand Up @@ -4922,6 +4924,7 @@ export function abort(request: Request, reason: mixed): void {
if (request.status <= OPEN) {
request.status = ABORTING;
}
request.cacheController.abort(reason);
const abortableTasks = request.abortableTasks;
if (abortableTasks.size > 0) {
if (enableHalt && request.type === PRERENDER) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const DefaultAsyncDispatcher: AsyncDispatcher = ({
return entry;
},
cacheSignal(): null | AbortSignal {
const request = resolveRequest();
if (request) {
return request.cacheController.signal;
}
return null;
},
}: any);
Expand Down