Skip to content

Commit

Permalink
fix(web): websocket stateUUID watch
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNotGoodName committed May 1, 2022
1 parent 025baee commit a48ec99
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions left/web/src/hooks/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ export function useWS(stateUUID: Ref<string>) {

const reconnect = () => {
if (connected.value || connecting.value) {
return false
return
}

ws = connect()
return true
}

watch(stateUUID, () => {
if (reconnect()) {
if (!connected.value) {
reconnect()
return
}
if (connecting.value) {
return
}

Expand Down

0 comments on commit a48ec99

Please sign in to comment.