latitude-dev/latitude-llm

Websockets fails when redirect happens

Closed this issue · 1 comments

What?

when you enter a project we do a redirect to the proper commit version. In the meantime the socket tries to connect but it fails

Posible fix.

Do a delay of 200ms before start connecting.
Here
https://github.com/latitude-dev/latitude-llm/blob/main/apps/web/src/components/Providers/WebsocketsProvider/index.tsx#L42

import { IoProvider, useSocket } from 'socket.io-react-hook'

const enabled = useRef(false)
useEffect(() => {
  const timeout = setTimeout(() => {
    enabled.current = true
  }, 200)
}, [])
return useSocket(namespace, {
  enabled: enabled.current,
  // Other config
})

Something like this

Sentry issue

https://latitude-l5.sentry.io/issues/5945258374/?alert_rule_id=15461351&alert_type=issue&environment=production&notification_uuid=04c95b0e-f1c1-4f80-b961-39ae4037c99e&project=4507922531418112&referrer=slack

Last error in that sentry list is from beginning of oct. Resolving this one