From aeeecf56220a22bdf782b221fd7e83ec8b725090 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 16 Oct 2026 11:43:20 +0200 Subject: [PATCH] fix: link the account to the token variable AppConnect created, even if the path is edited mid-save Co-Authored-By: Claude Opus 5.5 --- frontend/src/lib/components/AppConnectInner.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/components/AppConnectInner.svelte b/frontend/src/lib/components/AppConnectInner.svelte index e69b3dc667..b67c76c08e 100644 --- a/frontend/src/lib/components/AppConnectInner.svelte +++ b/frontend/src/lib/components/AppConnectInner.svelte @@ -988,10 +988,13 @@ // OAuth flow: single secret variable for the token if (typeof value == 'string' && value != '' && !value.startsWith('$var:')) { savedVariableCount++ + // Read once: the path field stays editable while this awaits, and the account + // must link the variable this call created. + const tokenPath = path await VariableService.createVariable({ workspace: effectiveWorkspace, requestBody: { - path, + path: tokenPath, value: value, is_secret: true, description: emptyString(description) @@ -1002,13 +1005,12 @@ } }) if (accountData) { - // Links the variable just created, so it refreshes through the account. await OauthService.createAccount({ workspace: effectiveWorkspace, - requestBody: { ...accountData, variable_path: path } + requestBody: { ...accountData, variable_path: tokenPath } }) } - resourceValue['token'] = `$var:${path}` + resourceValue['token'] = `$var:${tokenPath}` } } else if (linkedSecrets.length === 1) { // Single secret: use the resource path as variable name (original behavior)