Avoid triggering notification in headless
Summary: There was a bug where headless version used to crash when crash reporter plugin used to get messages. So the problem was that it tried to trigger the notification in headless version, which obviously won't work. Solves this [bug](https://our.intern.facebook.com/intern/sandcastle/log/?instance_id=88210824&step_id=773963185&step_index=5&name=Get+headless+and+run+it) Bug: {F155634920} Reviewed By: jknoxville, danielbuechele Differential Revision: D14874122 fbshipit-source-id: 2614b16665a354be7a75844a372dbea7a59d7e55
This commit is contained in:
committed by
Facebook Github Bot
parent
7f20c34e34
commit
25f82986ea
@@ -23,7 +23,6 @@ import com.facebook.litho.annotations.OnUpdateState;
|
|||||||
import com.facebook.litho.annotations.State;
|
import com.facebook.litho.annotations.State;
|
||||||
import com.facebook.litho.fresco.FrescoImage;
|
import com.facebook.litho.fresco.FrescoImage;
|
||||||
import com.facebook.litho.widget.Text;
|
import com.facebook.litho.widget.Text;
|
||||||
|
|
||||||
@LayoutSpec
|
@LayoutSpec
|
||||||
public class RootComponentSpec {
|
public class RootComponentSpec {
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type {Store} from '../reducers/index.js';
|
|||||||
import type {Logger} from '../fb-interfaces/Logger.js';
|
import type {Logger} from '../fb-interfaces/Logger.js';
|
||||||
import type {PluginNotification} from '../reducers/notifications';
|
import type {PluginNotification} from '../reducers/notifications';
|
||||||
import type {FlipperPlugin, FlipperDevicePlugin} from '../plugin.js';
|
import type {FlipperPlugin, FlipperDevicePlugin} from '../plugin.js';
|
||||||
|
import isHeadless from '../utils/isHeadless.js';
|
||||||
import {ipcRenderer} from 'electron';
|
import {ipcRenderer} from 'electron';
|
||||||
import {selectPlugin} from '../reducers/connections';
|
import {selectPlugin} from '../reducers/connections';
|
||||||
import {
|
import {
|
||||||
@@ -128,6 +128,7 @@ export default (store: Store, logger: Logger) => {
|
|||||||
|
|
||||||
activeNotifications.forEach((n: PluginNotification) => {
|
activeNotifications.forEach((n: PluginNotification) => {
|
||||||
if (
|
if (
|
||||||
|
!isHeadless() &&
|
||||||
store.getState().connections.selectedPlugin !== 'notifications' &&
|
store.getState().connections.selectedPlugin !== 'notifications' &&
|
||||||
!knownNotifications.has(n.notification.id) &&
|
!knownNotifications.has(n.notification.id) &&
|
||||||
blacklistedPlugins.indexOf(n.pluginId) === -1 &&
|
blacklistedPlugins.indexOf(n.pluginId) === -1 &&
|
||||||
|
|||||||
10
src/utils/isHeadless.js
Normal file
10
src/utils/isHeadless.js
Normal file
@@ -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';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user