Skip to content

Commit

Permalink
Inject getCurrentFiber() function to DevTools (#16133)
Browse files Browse the repository at this point in the history
This returns the current value of ReactCurrentFiber and enables DevTools to append a custom (owner-only) component stack to warnings and errors in DEV mode.
  • Loading branch information
Brian Vaughn committed Jul 15, 2019
1 parent 9f39590 commit 424099d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-reconciler/src/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ if (__DEV__) {

export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {
const {findFiberByHostInstance} = devToolsConfig;
const {ReactCurrentDispatcher, ReactDebugCurrentFrame} = ReactSharedInternals;
const {ReactCurrentDispatcher} = ReactSharedInternals;

return injectInternals({
...devToolsConfig,
Expand Down Expand Up @@ -501,7 +501,7 @@ export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {
scheduleRefresh: __DEV__ ? scheduleRefresh : null,
scheduleRoot: __DEV__ ? scheduleRoot : null,
setRefreshHandler: __DEV__ ? setRefreshHandler : null,
// Enables DevTools to append component stack to error messages in DEV mode.
debugCurrentFrame: ReactDebugCurrentFrame,
// Enables DevTools to append owner stacks to error messages in DEV mode.
getCurrentFiber: __DEV__ ? () => ReactCurrentFiberCurrent : null,
});
}

0 comments on commit 424099d

Please sign in to comment.