Disable websockets in shared boards (#1391)
* Disable websockets in shared boards * Address review comments * Fix linter
This commit is contained in:
parent
c852ae2802
commit
711da0409f
1 changed files with 15 additions and 6 deletions
|
@ -81,6 +81,13 @@ const App = React.memo((): JSX.Element => {
|
|||
const me = useAppSelector<IUser|null>(getMe)
|
||||
const dispatch = useAppDispatch()
|
||||
|
||||
// this is a temporary solution while we're using legacy routes
|
||||
// for shared boards as a way to disable websockets, and should be
|
||||
// removed when anonymous plugin routes are implemented. This
|
||||
// check is used to detect if we're running inside the plugin but
|
||||
// in a legacy route
|
||||
const inPluginLegacy = window.location.pathname.includes('/plugins/focalboard/')
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchLanguage())
|
||||
dispatch(fetchMe())
|
||||
|
@ -88,12 +95,14 @@ const App = React.memo((): JSX.Element => {
|
|||
history.replace(window.location.pathname.replace((window as any).frontendBaseURL, ''))
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
wsClient.open()
|
||||
return () => {
|
||||
wsClient.close()
|
||||
}
|
||||
}, [])
|
||||
if (!inPluginLegacy) {
|
||||
useEffect(() => {
|
||||
wsClient.open()
|
||||
return () => {
|
||||
wsClient.close()
|
||||
}
|
||||
}, [])
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (me) {
|
||||
|
|
Loading…
Reference in a new issue