From f2e2637c8e351611dc012bba646431feb250a3e8 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 6 Feb 2019 17:02:14 +0000 Subject: [PATCH] Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770) * Add current owner ref fallback for newer renderers with older react versions * Replaced current owner forward with current:null --- packages/shared/ReactSharedInternals.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/shared/ReactSharedInternals.js b/packages/shared/ReactSharedInternals.js index d8aea57f6bb3a..eaf526199046e 100644 --- a/packages/shared/ReactSharedInternals.js +++ b/packages/shared/ReactSharedInternals.js @@ -10,4 +10,13 @@ import React from 'react'; const ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +// Prevent newer renderers from RTE when used with older react package versions. +// Current owner and dispatcher used to share the same ref, +// but PR #14548 split them out to better support the react-debug-tools package. +if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { + ReactSharedInternals.ReactCurrentDispatcher = { + current: null, + }; +} + export default ReactSharedInternals;