Check if window is defined. Not all JS execution environments have it.

This commit is contained in:
Marc-Andre Ferland 2022-12-10 18:26:48 -05:00
parent e3184622e8
commit 7b2be12587

View File

@ -1081,7 +1081,7 @@
function getServerCapacity() { function getServerCapacity() {
let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length
if (window.document.visibilityState === 'hidden') { if (typeof window === "object" && window.document.visibilityState === 'hidden') {
activeDevicesCount = 1 + activeDevicesCount activeDevicesCount = 1 + activeDevicesCount
} }
return activeDevicesCount return activeDevicesCount