Content-Length: 2348 | pFad | http://github.com/coder/coder/pull/17584.patch
thub.com
From 55ee15fb659b9e39db7a3f151b110ec341b43a6c Mon Sep 17 00:00:00 2001
From: BrunoQuaresma
Date: Mon, 28 Apr 2025 13:59:58 +0000
Subject: [PATCH] fix: handle null value for experiments
---
.../DeploymentSettingsPage/optionValue.test.ts | 9 +++++++++
.../pages/DeploymentSettingsPage/optionValue.ts | 15 +++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/site/src/pages/DeploymentSettingsPage/optionValue.test.ts b/site/src/pages/DeploymentSettingsPage/optionValue.test.ts
index 90ca7d5cbec8d..ddb94fd4231d0 100644
--- a/site/src/pages/DeploymentSettingsPage/optionValue.test.ts
+++ b/site/src/pages/DeploymentSettingsPage/optionValue.test.ts
@@ -120,6 +120,15 @@ describe("optionValue", () => {
additionalValues: ["single_tailnet"],
expected: { single_tailnet: true },
},
+ {
+ option: {
+ ...defaultOption,
+ name: "Experiments",
+ value: null,
+ },
+ additionalValues: ["single_tailnet"],
+ expected: "",
+ },
{
option: {
...defaultOption,
diff --git a/site/src/pages/DeploymentSettingsPage/optionValue.ts b/site/src/pages/DeploymentSettingsPage/optionValue.ts
index 7e689c0e83dad..91821c998badf 100644
--- a/site/src/pages/DeploymentSettingsPage/optionValue.ts
+++ b/site/src/pages/DeploymentSettingsPage/optionValue.ts
@@ -40,8 +40,10 @@ export function optionValue(
case "Experiments": {
const experimentMap = additionalValues?.reduce>(
(acc, v) => {
- // biome-ignore lint/suspicious/noExplicitAny: opt.value is any
- acc[v] = (option.value as any).includes("*");
+ const isIncluded = Array.isArray(option.value)
+ ? option.value.includes("*")
+ : false;
+ acc[v] = isIncluded;
return acc;
},
{},
@@ -57,10 +59,11 @@ export function optionValue(
// We show all experiments (including unsafe) that are currently enabled on a deployment
// but only show safe experiments that are not.
- // biome-ignore lint/suspicious/noExplicitAny: opt.value is any
- for (const v of option.value as any) {
- if (v !== "*") {
- experimentMap[v] = true;
+ if (Array.isArray(option.value)) {
+ for (const v of option.value) {
+ if (v !== "*") {
+ experimentMap[v] = true;
+ }
}
}
return experimentMap;
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/coder/coder/pull/17584.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy