From ade6eabdb02c13597504cf8d534ef92b0268c165 Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Wed, 19 Dec 2018 06:57:57 -0800 Subject: [PATCH] Fix the regressed deeplink support for crash reporter plugin Summary: The deeplink from crash notification to crash reporter plugin was broken. It always showed the latest crash.With this diff the crashreporter plugin shows the correct crash information. Reviewed By: danielbuechele Differential Revision: D13487792 fbshipit-source-id: eee6826bb0a84d0aab9b432a1c9a04aa7d528402 --- src/plugins/crash_reporter/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/plugins/crash_reporter/index.js b/src/plugins/crash_reporter/index.js index ee1721370..26157ae75 100644 --- a/src/plugins/crash_reporter/index.js +++ b/src/plugins/crash_reporter/index.js @@ -126,11 +126,22 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin { }; render() { - const crash = - this.props.persistedState.crashes.length > 0 && - this.props.persistedState.crashes[ - this.props.persistedState.crashes.length - 1 - ]; + let crash: ?Crash = + this.props.persistedState.crashes.length > 0 + ? this.props.persistedState.crashes[ + this.props.persistedState.crashes.length - 1 + ] + : null; + + if (this.props.deepLinkPayload) { + const id = this.props.deepLinkPayload; + const index = this.props.persistedState.crashes.findIndex(elem => { + return elem.notificationID === Number(id); + }); + if (index >= 0) { + crash = this.props.persistedState.crashes[index]; + } + } if (crash) { const callstackString = crash.callstack; @@ -162,7 +173,11 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin { {this.device.os == 'Android' && ( -