@samitouri / QOS-React / commits / dc0dd4bbff

Use |0 to coerce to number (#14297)

Dan Abramov committed Nov 22, 2018 at 15:44 UTC dc0dd4bbff3f681216b13ae2842f1601bfae3cd8
1 file changed +2 -3
packages/react-dom/src/server/ReactPartialRendererContext.js
+2 -3
@@ -56,12 +56,11 @@ export function validateContextBounds(
56 context: ReactContext<any>,
57 threadID: ThreadID,
58 ) {
59 - // If `react` package is < 16.6, _threadCount is undefined.
60 - let initialThreadCount = context._threadCount || 0;
59 // If we don't have enough slots in this context to store this threadID,
60 // fill it in without leaving any holes to ensure that the VM optimizes
61 // this as non-holey index properties.
64 - for (let i = initialThreadCount; i <= threadID; i++) {
62 + // (Note: If `react` package is < 16.6, _threadCount is undefined.)
63 + for (let i = context._threadCount | 0; i <= threadID; i++) {
64 // We assume that this is the same as the defaultValue which might not be
65 // true if we're rendering inside a secondary renderer but they are
66 // secondary because these use cases are very rare.