Skip to content

Commit 2c4a074

Browse files
committed
default to empty string identifier prefix
1 parent b224f07 commit 2c4a074

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/react-server/src/ReactFlightHooks.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ function useId(): string {
107107
if (currentRequest === null) {
108108
throw new Error('useId can only be used while React is rendering');
109109
}
110-
const prefix = currentRequest.identifierPrefix
111-
? currentRequest.identifierPrefix
112-
: '';
113110
const id = currentRequest.identifierCount++;
114111
// use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client
115-
return ':' + prefix + 'S' + id.toString(32) + ':';
112+
return ':' + currentRequest.identifierPrefix + 'S' + id.toString(32) + ':';
116113
}

packages/react-server/src/ReactFlightServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export type Request = {
108108
writtenSymbols: Map<Symbol, number>,
109109
writtenModules: Map<ModuleKey, number>,
110110
writtenProviders: Map<string, number>,
111-
identifierPrefix?: string,
111+
identifierPrefix: string,
112112
identifierCount: number,
113113
onError: (error: mixed) => void,
114114
toJSON: (key: string, value: ReactModel) => ReactJSONValue,
@@ -148,7 +148,7 @@ export function createRequest(
148148
writtenSymbols: new Map(),
149149
writtenModules: new Map(),
150150
writtenProviders: new Map(),
151-
identifierPrefix,
151+
identifierPrefix: identifierPrefix || '',
152152
identifierCount: 1,
153153
onError: onError === undefined ? defaultErrorHandler : onError,
154154
toJSON: function(key: string, value: ReactModel): ReactJSONValue {

0 commit comments

Comments
 (0)