Unify error notifications (#1483)

Summary:
Note: this is to be stacked upon https://github.com/facebook/flipper/pull/1479

Note: this PR will probably not succeed against FB internal flipper, as I'm pretty sure there are more call sites that need to be updated. So consider this WIP

Currently connection errors are managed in the connection reducers, and are displayed through their own means, the error bar. Showing console.errors is also hooked up to this mechanism in FB internal flipper, but not at all in the OSS version, which means that some connection errors are never shown to the user.

Besides that there is a notification system that is used by for example the crash reporter and plugin updater.

Having effectively (at least) two notifications mechanisms is confusing and error prone. This PR unifies both approaches, and rather than having the connection reducer manage it's own errors, it leverages the more generic notifications reducer. Since, in the previous PR, console errors and warnings have become user facing (even in OSS and production builds, which wasn't the case before), there is no need anymore for a separate error bar.

I left the notifications mechanism itself as-is, but as discussed in the Sandy project the notification screen will probably be overhauled, and the system wide notifications will become in-app notifications.

## Changelog

Pull Request resolved: https://github.com/facebook/flipper/pull/1483

Test Plan: Only updated the unit tests at this point. Manual tests still need to be done.

Reviewed By: passy

Differential Revision: D23220896

Pulled By: mweststrate

fbshipit-source-id: 8ea37cf69ce9605dc232ca90afe9e2f70da26652
This commit is contained in:
Michel Weststrate
2020-08-21 10:05:19 -07:00
committed by Facebook GitHub Bot
parent 76b72f3d77
commit 81eb09e7b0
11 changed files with 133 additions and 435 deletions

View File

@@ -12,7 +12,6 @@ import {FlexRow, styled, Layout} from 'flipper';
import {connect} from 'react-redux';
import TitleBar from './chrome/TitleBar';
import MainSidebar2 from './chrome/mainsidebar/MainSidebar2';
import ErrorBar from './chrome/ErrorBar';
import DoctorBar from './chrome/DoctorBar';
import ShareSheetExportUrl from './chrome/ShareSheetExportUrl';
import SignInSheet from './chrome/SignInSheet';
@@ -40,7 +39,7 @@ import {
} from './reducers/application';
import {Logger} from './fb-interfaces/Logger';
import {State as Store} from './reducers/index';
import {StaticView, FlipperError} from './reducers/connections';
import {StaticView} from './reducers/connections';
import PluginManager from './chrome/plugin-manager/PluginManager';
import StatusBar from './chrome/StatusBar';
import SettingsSheet from './chrome/SettingsSheet';
@@ -59,7 +58,6 @@ type OwnProps = {
type StateFromProps = {
leftSidebarVisible: boolean;
errors: FlipperError[];
activeSheet: ActiveSheet;
share: ShareType | null;
staticView: StaticView;
@@ -174,7 +172,6 @@ export class App extends React.Component<Props> {
<>
<TitleBar version={version} />
<DoctorBar />
<ErrorBar />
</>
<>
<Sheet>{this.getSheet}</Sheet>
@@ -214,12 +211,11 @@ export class App extends React.Component<Props> {
export default connect<StateFromProps, DispatchProps, OwnProps, Store>(
({
application: {leftSidebarVisible, activeSheet, share},
connections: {errors, staticView},
connections: {staticView},
}) => ({
leftSidebarVisible,
activeSheet,
share: share,
errors,
staticView,
}),
{