From 4d14c57d729b3e6010295a208e6d32c53e2bfb70 Mon Sep 17 00:00:00 2001 From: Moritz Hedtke Date: Fri, 3 Jan 2025 13:18:12 +0100 Subject: [PATCH] fix: pass correct this object to WebSocket close handler. As Firefox calls onclose when navigating away this led to the setTimeout running instantly because of a timeout of `undefined` which then led to a reload of the page which breaks navigating away. --- src/autoreload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autoreload.js b/src/autoreload.js index 6c3b516f..1d9ace74 100644 --- a/src/autoreload.js +++ b/src/autoreload.js @@ -90,7 +90,7 @@ break; } }; - ws.onclose = this.onclose; + ws.onclose = () => this.onclose(); } onclose() {