From d333d30aa8b90be2358c27c2594af0805adeec03 Mon Sep 17 00:00:00 2001 From: amiraabouhadid Date: Tue, 17 Sep 2024 16:41:34 +0300 Subject: [PATCH 1/2] check for client before calling clientoptions --- packages/playground/src/App.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/playground/src/App.vue b/packages/playground/src/App.vue index 5b8d75701d..b22f3b6b48 100644 --- a/packages/playground/src/App.vue +++ b/packages/playground/src/App.vue @@ -336,16 +336,19 @@ async function setTimeouts() { } const client = gridStore.client as GridClient; - const clientOptions = client.clientOptions; + const localStorageDeploymentTimeout = localStorage.getItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY); - const deploymentTimeoutMinutes = clientOptions.deploymentTimeoutMinutes; - - if (client && clientOptions && deploymentTimeoutMinutes) { - if (!localStorageDeploymentTimeout) { - localStorage.setItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY, `${+deploymentTimeoutMinutes * 60}`); - } else { - client.clientOptions.deploymentTimeoutMinutes = +localStorageDeploymentTimeout! / 60; - await client.connect(); + + if (client) { + const clientOptions = client.clientOptions; + if (clientOptions) { + const deploymentTimeoutMinutes = clientOptions.deploymentTimeoutMinutes; + if (!localStorageDeploymentTimeout && deploymentTimeoutMinutes) { + localStorage.setItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY, `${+deploymentTimeoutMinutes * 60}`); + } else { + client.clientOptions.deploymentTimeoutMinutes = +localStorageDeploymentTimeout! / 60; + await client.connect(); + } } } } From 89346889bd8f7109083a0135f7ce9717aafa0616 Mon Sep 17 00:00:00 2001 From: amiraabouhadid Date: Sun, 22 Sep 2024 11:22:13 +0300 Subject: [PATCH 2/2] group conditionals --- packages/playground/src/App.vue | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/playground/src/App.vue b/packages/playground/src/App.vue index b22f3b6b48..8281da9fcb 100644 --- a/packages/playground/src/App.vue +++ b/packages/playground/src/App.vue @@ -339,20 +339,16 @@ async function setTimeouts() { const localStorageDeploymentTimeout = localStorage.getItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY); - if (client) { - const clientOptions = client.clientOptions; - if (clientOptions) { - const deploymentTimeoutMinutes = clientOptions.deploymentTimeoutMinutes; - if (!localStorageDeploymentTimeout && deploymentTimeoutMinutes) { - localStorage.setItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY, `${+deploymentTimeoutMinutes * 60}`); - } else { - client.clientOptions.deploymentTimeoutMinutes = +localStorageDeploymentTimeout! / 60; - await client.connect(); - } + if (client && client.clientOptions) { + const deploymentTimeoutMinutes = client.clientOptions.deploymentTimeoutMinutes; + if (!localStorageDeploymentTimeout && deploymentTimeoutMinutes) { + localStorage.setItem(LocalStorageSettingsKey.TIMEOUT_DEPLOYMENT_KEY, `${+deploymentTimeoutMinutes * 60}`); + } else { + client.clientOptions.deploymentTimeoutMinutes = +localStorageDeploymentTimeout! / 60; + await client.connect(); } } } - // eslint-disable-next-line no-undef const version = process.env.VERSION as any;