diff --git a/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java b/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java index e4d33498b..f4ae22d00 100644 --- a/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java +++ b/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java @@ -23,7 +23,6 @@ import com.facebook.litho.annotations.OnUpdateState; import com.facebook.litho.annotations.State; import com.facebook.litho.fresco.FrescoImage; import com.facebook.litho.widget.Text; - @LayoutSpec public class RootComponentSpec { diff --git a/src/dispatcher/notifications.js b/src/dispatcher/notifications.js index 428f7b80b..da2e649d9 100644 --- a/src/dispatcher/notifications.js +++ b/src/dispatcher/notifications.js @@ -9,7 +9,7 @@ import type {Store} from '../reducers/index.js'; import type {Logger} from '../fb-interfaces/Logger.js'; import type {PluginNotification} from '../reducers/notifications'; import type {FlipperPlugin, FlipperDevicePlugin} from '../plugin.js'; - +import isHeadless from '../utils/isHeadless.js'; import {ipcRenderer} from 'electron'; import {selectPlugin} from '../reducers/connections'; import { @@ -128,6 +128,7 @@ export default (store: Store, logger: Logger) => { activeNotifications.forEach((n: PluginNotification) => { if ( + !isHeadless() && store.getState().connections.selectedPlugin !== 'notifications' && !knownNotifications.has(n.notification.id) && blacklistedPlugins.indexOf(n.pluginId) === -1 && diff --git a/src/utils/isHeadless.js b/src/utils/isHeadless.js new file mode 100644 index 000000000..679869320 --- /dev/null +++ b/src/utils/isHeadless.js @@ -0,0 +1,10 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +export default function isHeadless(): boolean { + return typeof global.window === 'undefined'; +}