mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-21 13:38:56 +02:00
3ae821d2e8
* Refactor websockets state and lifecycle This PR moves the state of the authentication and subscriptions to the websockets client, allowing for multiple components to communicate with it and request subscriptions independently. With this change, the lifecycle of the websockets client is now managed on a component, and a hook is provided for easy access to it from individual components. * Fix linter * Integrating the new websockets in channels integration with the RHS and board selector * Some small fixes around boards-channels relationship * Make the boards unfurl to always use the current team * Fixing weird behaviors in websockets and other small data related bugs in channel-board relationship * Only warn if withWebSockets is used without a base connection * Fix tests * Fix linter * Update snapshot * Fixing plugin tests Co-authored-by: Jesús Espino <jespinog@gmail.com>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import React from 'react'
|
|
import ReactDOM from 'react-dom'
|
|
import {Provider as ReduxProvider} from 'react-redux'
|
|
import {store as emojiMartStore} from 'emoji-mart'
|
|
|
|
import App from './app'
|
|
import {initThemes} from './theme'
|
|
import {importNativeAppSettings} from './nativeApp'
|
|
import {UserSettings} from './userSettings'
|
|
|
|
import {IUser} from './user'
|
|
import {getMe} from './store/users'
|
|
import {useAppSelector} from './store/hooks'
|
|
|
|
import '@mattermost/compass-icons/css/compass-icons.css'
|
|
|
|
import './styles/variables.scss'
|
|
import './styles/main.scss'
|
|
import './styles/labels.scss'
|
|
import './styles/_markdown.scss'
|
|
|
|
import store from './store'
|
|
import WithWebSockets from './components/withWebSockets'
|
|
|
|
emojiMartStore.setHandlers({getter: UserSettings.getEmojiMartSetting, setter: UserSettings.setEmojiMartSetting})
|
|
importNativeAppSettings()
|
|
|
|
initThemes()
|
|
|
|
const MainApp = () => {
|
|
const me = useAppSelector<IUser|null>(getMe)
|
|
|
|
return (
|
|
<WithWebSockets userId={me?.id}>
|
|
<App/>
|
|
</WithWebSockets>
|
|
)
|
|
}
|
|
|
|
ReactDOM.render(
|
|
(
|
|
<ReduxProvider store={store}>
|
|
<MainApp/>
|
|
</ReduxProvider>
|
|
),
|
|
document.getElementById('focalboard-app'),
|
|
)
|