// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {useEffect} from 'react' import {IntlProvider} from 'react-intl' import {DndProvider} from 'react-dnd' import {HTML5Backend} from 'react-dnd-html5-backend' import {TouchBackend} from 'react-dnd-touch-backend' import {History} from 'history' import TelemetryClient from './telemetry/telemetryClient' import {getMessages} from './i18n' import {FlashMessages} from './components/flashMessages' import NewVersionBanner from './components/newVersionBanner' import {Utils} from './utils' import {fetchMe, getMe} from './store/users' import {getLanguage, fetchLanguage} from './store/language' import {useAppSelector, useAppDispatch} from './store/hooks' import {fetchClientConfig} from './store/clientConfig' import FocalboardRouter from './router' import {IUser} from './user' type Props = { history?: History } const App = (props: Props): JSX.Element => { const language = useAppSelector(getLanguage) const me = useAppSelector(getMe) const dispatch = useAppDispatch() useEffect(() => { dispatch(fetchLanguage()) dispatch(fetchMe()) dispatch(fetchClientConfig()) }, []) useEffect(() => { if (me) { TelemetryClient.setUser(me) } }, [me]) return (
) } export default React.memo(App)