Solve the bug when default state was not added

Summary:
Due to faulty condition default state was not being added in the persistedState, which casued the following bug.

{F153286217}

Reviewed By: danielbuechele

Differential Revision: D14425166

fbshipit-source-id: 557dc3717b650dae90dc44ad12970a684cecbf24
This commit is contained in:
Pritesh Nandgaonkar
2019-03-13 05:25:06 -07:00
committed by Facebook Github Bot
parent c2b6df7c3b
commit 2f3678d6e3
2 changed files with 7 additions and 7 deletions

View File

@@ -101,13 +101,12 @@ class PluginContainer extends PureComponent<Props> {
const props: PluginProps<Object> = {
key: pluginKey,
logger: this.props.logger,
persistedState:
!isArchivedDevice && activePlugin.defaultPersistedState
? {
...activePlugin.defaultPersistedState,
...pluginState,
}
: pluginState,
persistedState: activePlugin.defaultPersistedState
? {
...activePlugin.defaultPersistedState,
...pluginState,
}
: pluginState,
setPersistedState: state => setPluginState({pluginKey, state}),
target,
deepLinkPayload: this.props.deepLinkPayload,

View File

@@ -380,6 +380,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
render() {
let crash: ?Crash =
this.props.persistedState.crashes &&
this.props.persistedState.crashes.length > 0
? this.props.persistedState.crashes[
this.props.persistedState.crashes.length - 1