diff --git a/plugins/love-resources/src/components/ControlExt.svelte b/plugins/love-resources/src/components/ControlExt.svelte
index 971865015d..a08fce5cfe 100644
--- a/plugins/love-resources/src/components/ControlExt.svelte
+++ b/plugins/love-resources/src/components/ControlExt.svelte
@@ -352,7 +352,7 @@
   })
 
   const beforeUnloadListener = () => {
-    if ($myInfo !== undefined) {
+    if ($myInfo !== undefined && $isCurrentInstanceConnected) {
       leaveRoom($myInfo, $myOffice)
     }
   }