Skip to content

Commit f2e2637

Browse files
authored
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
1 parent 1107b96 commit f2e2637

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/shared/ReactSharedInternals.js

+9
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ import React from 'react';
1010
const ReactSharedInternals =
1111
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1212

13+
// Prevent newer renderers from RTE when used with older react package versions.
14+
// Current owner and dispatcher used to share the same ref,
15+
// but PR #14548 split them out to better support the react-debug-tools package.
16+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
17+
ReactSharedInternals.ReactCurrentDispatcher = {
18+
current: null,
19+
};
20+
}
21+
1322
export default ReactSharedInternals;

0 commit comments

Comments
 (0)