next
Version:
The React Framework
29 lines (28 loc) • 1.01 kB
TypeScript
/**
* Vary Params Decoding
*
* This module is shared between server and client.
*/
export type VaryParams = Set<string>;
type FulfilledVaryParamsThenable = {
status: 'fulfilled';
value: VaryParams;
} & PromiseLike<VaryParams>;
type PendingVaryParamsThenable = {
status: 'pending' | 'resolved_model';
value: unknown;
} & PromiseLike<VaryParams>;
export type VaryParamsThenable = FulfilledVaryParamsThenable | PendingVaryParamsThenable;
/**
* Synchronously reads vary params from a thenable.
*
* By the time this is called (client-side or in collectSegmentData), the
* thenable should already be fulfilled because the Flight stream has been
* fully received. We check the status synchronously to avoid unnecessary
* microtasks.
*
* Returns null if the thenable is still pending (which shouldn't happen in
* normal operation - it indicates the server failed to track vary params).
*/
export declare function readVaryParams(thenable: VaryParamsThenable): VaryParams | null;
export {};