Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Refactor OAuth service handling and improve event listener management in APICall component

Muhammad Hamza Khan256e996040c1
diff --git a/packages/app/src/builder-ui/components/APICall.class.ts b/packages/app/src/builder-ui/components/APICall.class.ts
index ad833296..bae6ed97 100644
--- a/packages/app/src/builder-ui/components/APICall.class.ts
+++ b/packages/app/src/builder-ui/components/APICall.class.ts
@@ -1573,8 +1573,16 @@ export class APICall extends Component {
} else {
// Don't update this.data.oauth_con_id directly - let the form save mechanism handle it
- // Don't update this.data.oauthService directly - let the form save mechanism handle it
- // The oauthService field will be updated through the form save mechanism
+ // Always synchronize the component's legacy field (oauthService) with the selected connection
+ // to avoid stale/broken state across legacy/new structures.
+ const selectedConn = this.oauthConnections[selectedValue];
+ const selectedOauthInfo = this.getConnectionOauthInfo(selectedConn, selectedValue);
+ if (selectedOauthInfo?.service) {
+ // Store a user-friendly value for legacy consumers
+ this.data.oauthService = mapInternalToServiceName(selectedOauthInfo.service);
+ } else {
+ this.data.oauthService = 'None';
+ }
// If the selection has changed, check authentication status and update button
if (selectedValue !== previousValue) {