From 4ed955ba324b15eca27b90e588fd2d9e551d7abb Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Mon, 29 Apr 2024 20:45:26 -0500 Subject: [PATCH] fix(multiplayer): don't attempt to go online there is a connection issue --- src/components/Farmhand/Farmhand.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Farmhand/Farmhand.js b/src/components/Farmhand/Farmhand.js index a7d42fef2..1251cb046 100644 --- a/src/components/Farmhand/Farmhand.js +++ b/src/components/Farmhand/Farmhand.js @@ -668,6 +668,7 @@ export default class Farmhand extends FarmhandReducers { const decodedRoom = decodeURIComponent(newRoom) + // NOTE: This indicates that the client should attempt to connect to the server const newIsOnline = path.startsWith('/online') if (newIsOnline !== this.state.isOnline || decodedRoom !== room) { @@ -679,7 +680,9 @@ export default class Farmhand extends FarmhandReducers { } if (isOnline !== prevState.isOnline || room !== prevState.room) { - this.syncToRoom() + if (newIsOnline) { + this.syncToRoom() + } if (!isOnline && typeof heartbeatTimeoutId === 'number') { clearTimeout(heartbeatTimeoutId)