Skip to content

Commit

Permalink
fix(useWebSocket): only reconnect if is the current ws socket (#4161)
Browse files Browse the repository at this point in the history
  • Loading branch information
freakbite committed Aug 24, 2024
1 parent a24411e commit e0e99c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/useWebSocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export function useWebSocket<Data = any>(
status.value = 'CLOSED'
onDisconnected?.(ws, ev)

if (!explicitlyClosed && options.autoReconnect) {
if (!explicitlyClosed && options.autoReconnect && ws === wsRef.value) {
const {
retries = -1,
delay = 1000,
Expand Down

0 comments on commit e0e99c8

Please sign in to comment.