Remove instanceof checks

Summary: Replaced `instanceof` checks with `isSandyPlugin` utility. That is cleaner to read and makes it easier to find places where we make exceptions for Sandy plugins

Reviewed By: jknoxville

Differential Revision: D22206707

fbshipit-source-id: b44a1b585424f3b9bf0d7ce200c34107f03ed55e
This commit is contained in:
Michel Weststrate
2020-07-01 08:58:40 -07:00
committed by Facebook GitHub Bot
parent 1dc9e899b8
commit 04a29315e2
11 changed files with 45 additions and 34 deletions

View File

@@ -12,7 +12,7 @@ import fs from 'fs';
import {Store, State} from '../reducers';
import {getPluginKey} from './pluginUtils';
import {serialize} from './serialization';
import {SandyPluginDefinition} from 'flipper-plugin';
import {isSandyPlugin} from '../plugin';
let pluginRecordingState: {
recording: string;
@@ -69,9 +69,7 @@ async function flipperStartPluginRecording(state: State) {
// device state, and is used for creating Flipper Exports.
pluginRecordingState.startState = await serialize(
state.pluginStates[pluginKey] ||
(plugin instanceof SandyPluginDefinition
? {}
: plugin.defaultPersistedState),
(isSandyPlugin(plugin) ? {} : plugin.defaultPersistedState),
);
console.log(