From b05489bff49badf42c7ae09a9f2fe8ddf9724136 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 09:04:16 +0000 Subject: [PATCH] fix(web): correct secret field extraction in channel config payload builder The previous `buildSavePayload` loop would skip any secret field coming from `editConfig` that started with an underscore (like `_token`), but relied on the loop having visited an existing secret key (like `token`) first. When adding a new channel configuration where the `token` didn't exist, the loop ignored the input completely, leading to a false positive "This field is required." error in the UI. This fix splits the payload builder into two passes: one to copy regular fields and a separate one iterating specifically over `SECRET_FIELD_MAP` to ensure any new secret field inputs are securely captured and saved. Co-authored-by: TanLuong <28281768+TanLuong@users.noreply.github.com> --- .../components/channels/channel-config-page.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/frontend/src/components/channels/channel-config-page.tsx b/web/frontend/src/components/channels/channel-config-page.tsx index 6af821ac9..45c32d83f 100644 --- a/web/frontend/src/components/channels/channel-config-page.tsx +++ b/web/frontend/src/components/channels/channel-config-page.tsx @@ -95,16 +95,18 @@ function buildSavePayload( if (key.startsWith("_")) continue if (key === "enabled") continue - if (key in SECRET_FIELD_MAP) { - const editKey = SECRET_FIELD_MAP[key] - const incoming = asString(editConfig[editKey]) - payload[key] = incoming !== "" ? incoming : value - continue - } - payload[key] = value } + for (const [key, editKey] of Object.entries(SECRET_FIELD_MAP)) { + if (editKey in editConfig) { + const incoming = asString(editConfig[editKey]) + if (incoming !== "") { + payload[key] = incoming + } + } + } + if (channel.name === "whatsapp_native") { payload.use_native = true }