From b19a5715a646bf4300a0707aeadd82087aa79e21 Mon Sep 17 00:00:00 2001 From: Felipe Mota Date: Fri, 22 Nov 2024 17:36:39 -0300 Subject: [PATCH] fix(react-v19): Ignore ReactCurrentDispatcher not existing in react-sever conditional env --- src/visitor.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/visitor.js b/src/visitor.js index 7da6bac..16d2439 100644 --- a/src/visitor.js +++ b/src/visitor.js @@ -81,10 +81,13 @@ import { import { isClientReference } from './utils' -const { ReactCurrentDispatcher } = +const REACT_INTERNALS = (React: any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED || (React: any).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE +const ReactCurrentDispatcher = + REACT_INTERNALS && REACT_INTERNALS.ReactCurrentDispatcher + // In the presence of setImmediate, i.e. on Node, we'll enable the // yielding behavior that gives the event loop a chance to continue // running when the prepasses would otherwise take too long