Summary: This diff removes some irrelevant error messages that are always logged in the OSS build, and got even reported a few times. The yarn lock file somehow got in a state where emotion/core was included twice (probably due to having a really old yarn version here), causing the logs view to crash. So fixed that manually. P.S. the fact that the warning in the screenshot does not take the full width is an issue in console-feed component itself, I opened https://github.com/samdenty/console-feed/pull/50 for that ## Changelog changelog: Removed some irrelevant errors from startup flow Pull Request resolved: https://github.com/facebook/flipper/pull/1484 Test Plan: Before  After  Reviewed By: jknoxville Differential Revision: D23220937 Pulled By: mweststrate fbshipit-source-id: 5f7b28adfbf99c938ad3abba75f26c6917463510
44 lines
1022 B
TypeScript
44 lines
1022 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import {Store} from '../reducers/index';
|
|
import {Logger} from '../fb-interfaces/Logger';
|
|
import {login, logout} from '../reducers/user';
|
|
import {getUser, logoutUser} from '../fb-stubs/user';
|
|
import {sideEffect} from '../utils/sideEffect';
|
|
import config from '../fb-stubs/config';
|
|
|
|
export default (store: Store, _logger: Logger) => {
|
|
if (!config.isFBBuild) {
|
|
return;
|
|
}
|
|
|
|
getUser()
|
|
.then((user) => {
|
|
store.dispatch(login(user));
|
|
})
|
|
.catch((e) => {
|
|
store.dispatch(logout());
|
|
console.error(e);
|
|
});
|
|
|
|
let prevUserName = store.getState().user.name;
|
|
sideEffect(
|
|
store,
|
|
{name: 'logout', throttleMs: 500},
|
|
(state) => state.user.name,
|
|
(userName) => {
|
|
if (prevUserName && !userName) {
|
|
logoutUser();
|
|
}
|
|
prevUserName = userName;
|
|
},
|
|
);
|
|
};
|