Skip to content

Commit e0e99c8

Browse files
authoredAug 24, 2024··
fix(useWebSocket): only reconnect if is the current ws socket (#4161)
1 parent a24411e commit e0e99c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎packages/core/useWebSocket/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function useWebSocket<Data = any>(
230230
status.value = 'CLOSED'
231231
onDisconnected?.(ws, ev)
232232

233-
if (!explicitlyClosed && options.autoReconnect) {
233+
if (!explicitlyClosed && options.autoReconnect && ws === wsRef.value) {
234234
const {
235235
retries = -1,
236236
delay = 1000,

0 commit comments

Comments
 (0)
Please sign in to comment.