Bug fix when the selectedPlugin is Layout, and trace is imported

Summary:
Fixes a bug which happened when the selected plugin was layout and the flipper trace was imported. While importing the trace in the mentioned scenario, the redux store didn't used to get updated in the first render but got updated in the second render. Due to which the persisted state passed in the props was undefined. Look at the attached video to understand the bug.

BUG:

{F152642401}

Reviewed By: passy

Differential Revision: D14343465

fbshipit-source-id: 59110fd6ee5839f2e3944792e1c288d2388d3340
This commit is contained in:
Pritesh Nandgaonkar
2019-03-06 09:27:32 -08:00
committed by Facebook Github Bot
parent 410b6a6043
commit 04d2880b25

View File

@@ -85,6 +85,10 @@ export default class Layout extends FlipperPlugin<State, void, PersistedState> {
};
init() {
if (!this.props.persistedState) {
// If the selected plugin from the previous session was layout, then while importing the flipper trace, the redux store doesn't get updated in the first render, due to which the plugin crashes, as it has no persisted state
this.props.setPersistedState(this.constructor.defaultPersistedState);
}
// persist searchActive state when moving between plugins to prevent multiple
// TouchOverlayViews since we can't edit the view heirarchy in onDisconnect
this.client.call('isSearchActive').then(({isSearchActive}) => {