Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion src/browser/http_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,7 @@ function forwardErrorData(errorData: JSONValue, error: ConvexError<string>) {
/**
* @internal
*/
type FetchOptions = { cache: "force-cache" | "no-store" };
type FetchOptions = {
cache: "force-cache" | "no-store";
signal?: AbortSignal;
};
11 changes: 10 additions & 1 deletion src/nextjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ export type NextjsOptions = {
* The default value is `false`
*/
skipConvexDeploymentUrlCheck?: boolean;
/**
* AbortSignal to cancel the request.
*
* Use with React 19.2's cacheSignal() to abort fetches when cache lifetime ends.
*/
signal?: AbortSignal | null;
};

/**
Expand Down Expand Up @@ -199,7 +205,10 @@ function setupClient(options: NextjsOptions) {
if (options.adminToken !== undefined) {
client.setAdminAuth(options.adminToken);
}
client.setFetchOptions({ cache: "no-store" });
client.setFetchOptions({
cache: "no-store",
signal: options.signal ?? undefined,
});
return client;
}

Expand Down