Skip to content

Commit

Permalink
Backwards compat fix for ReactCurrentDispatcher on older react versio…
Browse files Browse the repository at this point in the history
…ns (#14770)

* Add current owner ref fallback for newer renderers with older react versions
* Replaced current owner forward with current:null
  • Loading branch information
bvaughn committed Feb 6, 2019
1 parent 1107b96 commit f2e2637
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/shared/ReactSharedInternals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit f2e2637

Please sign in to comment.