From dc0dd4bbff3f681216b13ae2842f1601bfae3cd8 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 22 Nov 2018 15:44:00 +0000 Subject: [PATCH] Use |0 to coerce to number (#14297) --- packages/react-dom/src/server/ReactPartialRendererContext.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-dom/src/server/ReactPartialRendererContext.js b/packages/react-dom/src/server/ReactPartialRendererContext.js index b10e392e37..d7ceaa0975 100644 --- a/packages/react-dom/src/server/ReactPartialRendererContext.js +++ b/packages/react-dom/src/server/ReactPartialRendererContext.js @@ -56,12 +56,11 @@ export function validateContextBounds( context: ReactContext, threadID: ThreadID, ) { - // If `react` package is < 16.6, _threadCount is undefined. - let initialThreadCount = context._threadCount || 0; // If we don't have enough slots in this context to store this threadID, // fill it in without leaving any holes to ensure that the VM optimizes // this as non-holey index properties. - for (let i = initialThreadCount; i <= threadID; i++) { + // (Note: If `react` package is < 16.6, _threadCount is undefined.) + for (let i = context._threadCount | 0; i <= threadID; i++) { // We assume that this is the same as the defaultValue which might not be // true if we're rendering inside a secondary renderer but they are // secondary because these use cases are very rare.