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 me = useAppSelector<IUser|null>(getMe)
|
||||||
const dispatch = useAppDispatch()
|
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(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchLanguage())
|
dispatch(fetchLanguage())
|
||||||
dispatch(fetchMe())
|
dispatch(fetchMe())
|
||||||
|
@ -88,12 +95,14 @@ const App = React.memo((): JSX.Element => {
|
||||||
history.replace(window.location.pathname.replace((window as any).frontendBaseURL, ''))
|
history.replace(window.location.pathname.replace((window as any).frontendBaseURL, ''))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
if (!inPluginLegacy) {
|
||||||
wsClient.open()
|
useEffect(() => {
|
||||||
return () => {
|
wsClient.open()
|
||||||
wsClient.close()
|
return () => {
|
||||||
}
|
wsClient.close()
|
||||||
}, [])
|
}
|
||||||
|
}, [])
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (me) {
|
if (me) {
|
||||||
|
|
Loading…
Reference in a new issue