Skip to content

Commit

Permalink
Rename ServerReferenceMetadata type to ServerReferenceId
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Mar 3, 2023
1 parent 6448839 commit 7936faa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import isArray from 'shared/isArray';

export type ClientReference<T> = JSResourceReference<T>;
export type ServerReference<T> = T;
export type ServerReferenceMetadata = {};
export type ServerReferenceId = {};

import type {
Destination,
Expand Down Expand Up @@ -69,7 +69,7 @@ export function resolveClientReferenceMetadata<T>(
export function resolveServerReferenceMetadata<T>(
config: BundlerConfig,
resource: ServerReference<T>,
): {id: ServerReferenceMetadata, bound: Promise<Array<any>>} {
): {id: ServerReferenceId, bound: Promise<Array<any>>} {
throw new Error('Not implemented.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type ServerReference<T: Function> = T & {
$$bound: Array<ReactModel>,
};

export type ServerReferenceMetadata = string;
export type ServerReferenceId = string;

// eslint-disable-next-line no-unused-vars
export type ClientReference<T> = {
Expand Down Expand Up @@ -76,7 +76,7 @@ export function resolveClientReferenceMetadata<T>(
export function resolveServerReferenceMetadata<T>(
config: BundlerConfig,
serverReference: ServerReference<T>,
): {id: ServerReferenceMetadata, bound: Promise<Array<any>>} {
): {id: ServerReferenceId, bound: Promise<Array<any>>} {
return {
id: serverReference.$$id,
bound: Promise.resolve(serverReference.$$bound),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import JSResourceReferenceImpl from 'JSResourceReferenceImpl';

export type ClientReference<T> = JSResourceReference<T>;
export type ServerReference<T> = T;
export type ServerReferenceMetadata = {};
export type ServerReferenceId = {};

import type {
Destination,
Expand Down Expand Up @@ -66,7 +66,7 @@ export function resolveClientReferenceMetadata<T>(
export function resolveServerReferenceMetadata<T>(
config: BundlerConfig,
resource: ServerReference<T>,
): {id: ServerReferenceMetadata, bound: Promise<Array<any>>} {
): {id: ServerReferenceId, bound: Promise<Array<any>>} {
throw new Error('Not implemented.');
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
ClientReference,
ClientReferenceKey,
ServerReference,
ServerReferenceMetadata,
ServerReferenceId,
} from './ReactFlightServerConfig';
import type {ContextSnapshot} from './ReactFlightNewContext';
import type {ThenableState} from './ReactFlightThenable';
Expand Down Expand Up @@ -591,7 +591,7 @@ function serializeServerReference(
return serializeServerReferenceID(existingId);
}
const serverReferenceMetadata: {
id: ServerReferenceMetadata,
id: ServerReferenceId,
bound: Promise<Array<any>>,
} = resolveServerReferenceMetadata(request.bundlerConfig, serverReference);
request.pendingChunks++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export opaque type BundlerConfig = mixed;
export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars
export opaque type ServerReference<T> = mixed; // eslint-disable-line no-unused-vars
export opaque type ClientReferenceMetadata: any = mixed;
export opaque type ServerReferenceMetadata: any = mixed;
export opaque type ServerReferenceId: any = mixed;
export opaque type ClientReferenceKey: any = mixed;
export const isClientReference = $$$hostConfig.isClientReference;
export const isServerReference = $$$hostConfig.isServerReference;
Expand Down

0 comments on commit 7936faa

Please sign in to comment.