Skip to content

Commit c736478

Browse files
committed
No need to conditionally check if it exists since we know it'll exist
1 parent c648fcd commit c736478

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/react-server/src/ReactServerStreamConfigBrowser.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function writeChunk(
4747

4848
if (chunk.length > VIEW_SIZE) {
4949
if (__DEV__) {
50-
if (precomputedChunkSet && precomputedChunkSet.has(chunk)) {
50+
if (precomputedChunkSet.has(chunk)) {
5151
console.error(
5252
'A large precomputed chunk was passed to writeChunk without being copied.' +
5353
' Large chunks get enqueued directly and are not copied. This is incompatible with precomputed chunks because you cannot enqueue the same precomputed chunk twice.' +
@@ -126,15 +126,13 @@ export function stringToChunk(content: string): Chunk {
126126
return textEncoder.encode(content);
127127
}
128128

129-
const precomputedChunkSet = __DEV__ ? new Set() : null;
129+
const precomputedChunkSet: Set<Chunk> = __DEV__ ? new Set() : (null: any);
130130

131131
export function stringToPrecomputedChunk(content: string): PrecomputedChunk {
132132
const precomputedChunk = textEncoder.encode(content);
133133

134134
if (__DEV__) {
135-
if (precomputedChunkSet) {
136-
precomputedChunkSet.add(precomputedChunk);
137-
}
135+
precomputedChunkSet.add(precomputedChunk);
138136
}
139137

140138
return precomputedChunk;

0 commit comments

Comments
 (0)