Commit b7e0c0c4 authored by Adam Parák's avatar Adam Parák 💬
Browse files

3.0.3 Websocket fix

parent fc64e4f3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
import { routes } from '@generouted/react-router'
import Connection from '@inject/graphql/connection'
import UrqlClient from '@inject/graphql/urql/client'
import { WebsocketDeath } from '@inject/graphql/urql/WebSocketDeath'
import PopupEngine from '@inject/shared/popup/PopupEngine'
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
import DocViewerElement from './classes/DocViewerElement'
@@ -14,6 +15,7 @@ const Application = () => {
    <Connection>
      <UrqlClient>
        <PopupEngine>
          <WebsocketDeath />
          <RouterProvider router={router} />
        </PopupEngine>
      </UrqlClient>
+5 −1
Original line number Diff line number Diff line
@@ -142,7 +142,11 @@ const AllMilestoneIndicator: FC<MilestoneIndicatorProps> = ({
        className={Classes.ALERT}
      >
        <div className={Classes.ALERT_BODY}>
          <Icon icon='warning-sign' size={40} intent={teamIds.length === 0 ? 'danger' : 'warning'} />
          <Icon
            icon='warning-sign'
            size={40}
            intent={teamIds.length === 0 ? 'danger' : 'warning'}
          />
          <div className={Classes.ALERT_CONTENTS}>
            Are you sure you want to mark this milestone as{' '}
            {reached ? 'not reached' : 'reached'} for
+5 −7
Original line number Diff line number Diff line
@@ -40,13 +40,11 @@ const UserTableSelection: FC<UserTableSelectionProps> = ({
    setSelectedUsers([])
  }, [setOpen, setSelectedUsers])

  const tableProps = useUserTableSelection(
    {
  const tableProps = useUserTableSelection({
    groups,
    selectedUsers,
    setSelectedUsers,
    }
  )
  })

  return (
    <Dialog isOpen={open} onClose={handleCancel} className={maximizedDialog}>
+0 −2
Original line number Diff line number Diff line
@@ -65,8 +65,6 @@ const Login = () => {
        },
      })
      const res: { sessionid: string } = await req.json()
      localStorage.clear()
      sessionStorage.clear()
      indexedDB.deleteDatabase('graphcache-v3')
      if (req.status === 403) {
        throw res as unknown as { status: string; detail: string }
+32 −0
Original line number Diff line number Diff line
import { logoutUrl } from '@inject/shared/config'
import { toaster } from '@inject/shared/notification/toaster'
import authenticatedFetch from '@inject/shared/utils/authenticatedFetch'
import { useEventListener } from 'ahooks'
import { useHost } from '../connection/host'
import { sessionid } from '../connection/sessionid'

export const WebsocketDeath = () => {
  const host = useHost()
  useEventListener('offlineFall', () => {
    toaster.show({
      message: (
        <p>
          App is potentially desynchronized, it&apos;s adviced to refresh the
          application now. (you will be asked to log in again)
        </p>
      ),
      timeout: -1,
      action: {
        onClick: () => {
          window.dispatchEvent(new CustomEvent('killWs'))
          authenticatedFetch(logoutUrl(host)).then(() => {
            sessionid('')
            window.location.reload()
          })
        },
        text: 'Refresh',
      },
    })
  })
  return <></>
}
Loading