Consider callstack as nullable

Summary:
I received an error like this while rendering:

So we should type the callstack accordingly.

Reviewed By: priteshrnandgaonkar

Differential Revision: D15921517

fbshipit-source-id: 5863c75af142f1c22d5b520db8d7c0283f401e11
This commit is contained in:
Pascal Hartig
2019-06-20 10:24:52 -07:00
committed by Facebook Github Bot
parent f40ac0617c
commit 375e313736

View File

@@ -57,7 +57,7 @@ type CrashSelectorProps = {|
export type Crash = {|
notificationID: string,
callstack: string,
callstack: ?string,
reason: string,
name: string,
date: Date,
@@ -676,15 +676,14 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
);
const selectedCrashID = crash.notificationID;
const onCrashChange = id => {
const newSelectedCrash = crashes.find(element => {
return element.notificationID === id;
});
const newSelectedCrash = crashes.find(
element => element.notificationID === id,
);
this.setState({crash: newSelectedCrash});
console.log('onCrashChange called', id);
};
const callstackString = crash.callstack;
const children = crash.callstack.split('\n').map(str => {
const callstackString = crash.callstack || '';
const children = callstackString.split('\n').map(str => {
return {message: str};
});
const crashSelector: CrashSelectorProps = {
@@ -699,7 +698,9 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
<CrashReporterBar
crashSelector={crashSelector}
openLogsCallback={() => {
if (crash.callstack) {
this.openInLogs(crash.callstack);
}
}}
/>
) : (