Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 197 additions & 93 deletions packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions packages/react-native/Libraries/Core/setUpDeveloperTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ declare var console: {[string]: $FlowFixMe};
* You can use this module directly, or just require InitializeCore.
*/
if (__DEV__) {
require('./setUpReactDevTools');

// Set up inspector
const JSInspector = require('../JSInspector/JSInspector');
JSInspector.registerAgent(require('../JSInspector/NetworkAgent'));
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native/Libraries/Core/setUpErrorHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

'use strict';

if (__DEV__) {
// React DevTools need to be set up before the console.error patch.
require('./setUpReactDevTools');
}

if (global.RN$useAlwaysAvailableJSErrorHandling !== true) {
/**
* Sets up the console and exception handling (redbox) for React Native.
Expand Down
62 changes: 42 additions & 20 deletions packages/react-native/Libraries/LogBox/Data/LogBoxLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LogBoxLog {
count: number;
level: LogLevel;
codeFrame: ?CodeFrame;
componentCodeFrame: ?CodeFrame;
isComponentError: boolean;
extraData: mixed | void;
symbolicated:
Expand Down Expand Up @@ -140,8 +141,18 @@ class LogBoxLog {
}

retrySymbolicate(callback?: (status: SymbolicationStatus) => void): void {
let retry = false;
if (this.symbolicated.status !== 'COMPLETE') {
LogBoxSymbolication.deleteStack(this.stack);
retry = true;
}
if (this.symbolicatedComponentStack.status !== 'COMPLETE') {
LogBoxSymbolication.deleteStack(
convertComponentStateToStack(this.componentStack),
);
retry = true;
}
if (retry) {
this.handleSymbolicate(callback);
}
}
Expand All @@ -153,7 +164,10 @@ class LogBoxLog {
}

handleSymbolicate(callback?: (status: SymbolicationStatus) => void): void {
if (this.symbolicated.status !== 'PENDING') {
if (
this.symbolicated.status !== 'PENDING' &&
this.symbolicated.status !== 'COMPLETE'
) {
this.updateStatus(null, null, null, callback);
LogBoxSymbolication.symbolicate(this.stack, this.extraData).then(
data => {
Expand All @@ -163,25 +177,30 @@ class LogBoxLog {
this.updateStatus(error, null, null, callback);
},
);
if (this.componentStack != null && this.componentStackType === 'stack') {
this.updateComponentStackStatus(null, null, null, callback);
const componentStackFrames = convertComponentStateToStack(
this.componentStack,
);
LogBoxSymbolication.symbolicate(componentStackFrames, []).then(
data => {
this.updateComponentStackStatus(
null,
convertStackToComponentStack(data.stack),
null,
callback,
);
},
error => {
this.updateComponentStackStatus(error, null, null, callback);
},
);
}
}
if (
this.componentStack != null &&
this.componentStackType === 'stack' &&
this.symbolicatedComponentStack.status !== 'PENDING' &&
this.symbolicatedComponentStack.status !== 'COMPLETE'
) {
this.updateComponentStackStatus(null, null, null, callback);
const componentStackFrames = convertComponentStateToStack(
this.componentStack,
);
LogBoxSymbolication.symbolicate(componentStackFrames, []).then(
data => {
this.updateComponentStackStatus(
null,
convertStackToComponentStack(data.stack),
data?.codeFrame,
callback,
);
},
error => {
this.updateComponentStackStatus(error, null, null, callback);
},
);
}
}

Expand Down Expand Up @@ -235,6 +254,9 @@ class LogBoxLog {
status: 'FAILED',
};
} else if (componentStack != null) {
if (codeFrame) {
this.componentCodeFrame = codeFrame;
}
this.symbolicatedComponentStack = {
error: null,
componentStack,
Expand Down
Loading