diff --git a/src/init.js b/src/init.js index 6dd0c3c8b..a104d0dce 100644 --- a/src/init.js +++ b/src/init.js @@ -27,11 +27,10 @@ const store = createStore( reducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), ); -persistStore(store); const logger = initLogger(store); const bugReporter = new BugReporter(logger, store); -dispatcher(store, logger); + GK.init(); const AppFrame = () => ( @@ -69,5 +68,9 @@ function init() { initCrashReporter(sessionId || ''); } -// make init function callable from outside -window.Flipper.init = init; +// rehydrate app state before exposing init +persistStore(store, null, () => { + dispatcher(store, logger); + // make init function callable from outside + window.Flipper.init = init; +}); diff --git a/src/reducers/connections.js b/src/reducers/connections.js index d035b09be..fba9ca801 100644 --- a/src/reducers/connections.js +++ b/src/reducers/connections.js @@ -6,6 +6,7 @@ */ import type BaseDevice from '../devices/BaseDevice'; +import MacDevice from '../devices/MacDevice'; import type Client from '../Client'; import type {UninitializedClient} from '../UninitializedClient'; import {isEqual} from 'lodash'; @@ -95,6 +96,7 @@ export type Action = }; const DEFAULT_PLUGIN = 'DeviceLogs'; +const DEFAULT_DEVICE_BLACKLIST = [MacDevice]; const INITAL_STATE: State = { devices: [], @@ -141,7 +143,11 @@ const reducer = (state: State = INITAL_STATE, action: Action): State => { selectedPlugin: DEFAULT_PLUGIN, }; - if (!selectedDevice) { + let canBeDefaultDevice = !DEFAULT_DEVICE_BLACKLIST.some( + blacklistedDevice => payload instanceof blacklistedDevice, + ); + + if (!selectedDevice && canBeDefaultDevice) { selectedDevice = payload; if (selectedPlugin) { // We already had a plugin selected, but no device. This is happening