YellowBox: Allow Retrying Symbolication
Summary: When symbolication fails, allow retrying without having to reload the current JS VM. Reviewed By: ejanzer Differential Revision: D9760666 fbshipit-source-id: 63837c81fe77a9b0b897a858e3d64bc7dcf2c3bd
This commit is contained in:
parent
5e6e5e92ca
commit
d6b9ec1c1f
|
@ -21,6 +21,10 @@ export type Stack = Array<StackFrame>;
|
||||||
const cache: Map<CacheKey, Promise<Stack>> = new Map();
|
const cache: Map<CacheKey, Promise<Stack>> = new Map();
|
||||||
|
|
||||||
const YellowBoxSymbolication = {
|
const YellowBoxSymbolication = {
|
||||||
|
delete(stack: Stack): void {
|
||||||
|
cache.delete(getCacheKey(stack));
|
||||||
|
},
|
||||||
|
|
||||||
symbolicate(stack: Stack): Promise<Stack> {
|
symbolicate(stack: Stack): Promise<Stack> {
|
||||||
const key = getCacheKey(stack);
|
const key = getCacheKey(stack);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,11 @@ class YellowBoxWarning {
|
||||||
: this.stack;
|
: this.stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retrySymbolicate(callback: () => void): SymbolicationRequest {
|
||||||
|
YellowBoxSymbolication.delete(this.stack);
|
||||||
|
return this.symbolicate(callback);
|
||||||
|
}
|
||||||
|
|
||||||
symbolicate(callback: () => void): SymbolicationRequest {
|
symbolicate(callback: () => void): SymbolicationRequest {
|
||||||
let aborted = false;
|
let aborted = false;
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,11 @@ class YellowBoxInspector extends React.Component<Props, State> {
|
||||||
<View style={styles.bodyHeading}>
|
<View style={styles.bodyHeading}>
|
||||||
<Text style={styles.bodyHeadingText}>Stack</Text>
|
<Text style={styles.bodyHeadingText}>Stack</Text>
|
||||||
<YellowBoxInspectorSourceMapStatus
|
<YellowBoxInspectorSourceMapStatus
|
||||||
|
onPress={
|
||||||
|
warning.symbolicated.status === 'FAILED'
|
||||||
|
? this._handleRetrySymbolication
|
||||||
|
: null
|
||||||
|
}
|
||||||
status={warning.symbolicated.status}
|
status={warning.symbolicated.status}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
@ -121,6 +126,16 @@ class YellowBoxInspector extends React.Component<Props, State> {
|
||||||
this._cancelSymbolication();
|
this._cancelSymbolication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_handleRetrySymbolication = () => {
|
||||||
|
this._cancelSymbolication();
|
||||||
|
this.forceUpdate(() => {
|
||||||
|
const warning = this.props.warnings[this.state.selectedIndex];
|
||||||
|
this._symbolication = warning.retrySymbolicate(() => {
|
||||||
|
this.forceUpdate();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
_handleSymbolication(): void {
|
_handleSymbolication(): void {
|
||||||
const warning = this.props.warnings[this.state.selectedIndex];
|
const warning = this.props.warnings[this.state.selectedIndex];
|
||||||
if (warning.symbolicated.status !== 'COMPLETE') {
|
if (warning.symbolicated.status !== 'COMPLETE') {
|
||||||
|
|
|
@ -15,14 +15,16 @@ const Easing = require('Easing');
|
||||||
const React = require('React');
|
const React = require('React');
|
||||||
const StyleSheet = require('StyleSheet');
|
const StyleSheet = require('StyleSheet');
|
||||||
const Text = require('Text');
|
const Text = require('Text');
|
||||||
const View = require('View');
|
|
||||||
const YellowBoxImageSource = require('YellowBoxImageSource');
|
const YellowBoxImageSource = require('YellowBoxImageSource');
|
||||||
|
const YellowBoxPressable = require('YellowBoxPressable');
|
||||||
const YellowBoxStyle = require('YellowBoxStyle');
|
const YellowBoxStyle = require('YellowBoxStyle');
|
||||||
|
|
||||||
import type {CompositeAnimation} from 'AnimatedImplementation';
|
import type {CompositeAnimation} from 'AnimatedImplementation';
|
||||||
import type AnimatedInterpolation from 'AnimatedInterpolation';
|
import type AnimatedInterpolation from 'AnimatedInterpolation';
|
||||||
|
import type {PressEvent} from 'CoreEventTypes';
|
||||||
|
|
||||||
type Props = $ReadOnly<{|
|
type Props = $ReadOnly<{|
|
||||||
|
onPress?: ?(event: PressEvent) => void,
|
||||||
status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING',
|
status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING',
|
||||||
|}>;
|
|}>;
|
||||||
|
|
||||||
|
@ -52,7 +54,13 @@ class YellowBoxInspectorSourceMapStatus extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return image == null ? null : (
|
return image == null ? null : (
|
||||||
<View
|
<YellowBoxPressable
|
||||||
|
backgroundColor={{
|
||||||
|
default: YellowBoxStyle.getTextColor(0.8),
|
||||||
|
pressed: YellowBoxStyle.getTextColor(0.6),
|
||||||
|
}}
|
||||||
|
hitSlop={{bottom: 8, left: 8, right: 8, top: 8}}
|
||||||
|
onPress={this.props.onPress}
|
||||||
style={StyleSheet.compose(
|
style={StyleSheet.compose(
|
||||||
styles.root,
|
styles.root,
|
||||||
this.props.status === 'PENDING' ? styles.pending : null,
|
this.props.status === 'PENDING' ? styles.pending : null,
|
||||||
|
@ -67,7 +75,7 @@ class YellowBoxInspectorSourceMapStatus extends React.Component<Props, State> {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.text}>Source Map</Text>
|
<Text style={styles.text}>Source Map</Text>
|
||||||
</View>
|
</YellowBoxPressable>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +133,6 @@ class YellowBoxInspectorSourceMapStatus extends React.Component<Props, State> {
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
root: {
|
root: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: YellowBoxStyle.getTextColor(0.8),
|
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
height: 24,
|
height: 24,
|
||||||
|
|
Loading…
Reference in New Issue