@samitouri / QOS-React-2 / commits / 424099da60

Inject getCurrentFiber() function to DevTools (#16133)

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.

Brian Vaughn committed Jul 15, 2019 at 07:38 UTC 424099da60a399aba200e96110cee6eaea53b0aa
1 file changed +3 -3
packages/react-reconciler/src/ReactFiberReconciler.js
+3 -3
@@ -473,7 +473,7 @@ if (__DEV__) {
473
474 export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {
475 const {findFiberByHostInstance} = devToolsConfig;
476 - const {ReactCurrentDispatcher, ReactDebugCurrentFrame} = ReactSharedInternals;
476 + const {ReactCurrentDispatcher} = ReactSharedInternals;
477
478 return injectInternals({
479 ...devToolsConfig,
@@ -501,7 +501,7 @@ export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {
501 scheduleRefresh: __DEV__ ? scheduleRefresh : null,
502 scheduleRoot: __DEV__ ? scheduleRoot : null,
503 setRefreshHandler: __DEV__ ? setRefreshHandler : null,
504 - // Enables DevTools to append component stack to error messages in DEV mode.
505 - debugCurrentFrame: ReactDebugCurrentFrame,
504 + // Enables DevTools to append owner stacks to error messages in DEV mode.
505 + getCurrentFiber: __DEV__ ? () => ReactCurrentFiberCurrent : null,
506 });
507 }