Severity
P2 - High (Major functionality broken)
Describe the Bug with repro steps
Describe the bug
The useEffect in ConnectionPanel calls autoCreateConnectionIfPossible without a re-entry guard, creating a loop that produces many redundant API calls when no connections exist for a connector.
Steps to reproduce
- Use the consumption designer with a connector that has single auth (no
connectionParameterSets), visible connection parameters, and an ARM resource ID
- Open the connection panel for a node using that connector where no connections of that type exist yet
- Observe repeated
getConnections and getConnection (404) API calls in the browser network tab
Root cause
File: libs/designer/src/lib/ui/panel/connectionsPanel/connectionsPanel.tsx (line 33)
ConnectionPanel mounts → useConnectionsForConnector(connectorId) returns []
useEffect sees connections.length === 0 → fires autoCreateConnectionIfPossible()
- Inside
autoCreateConnectionIfPossible, getUniqueConnectionName calls getConnectionsForConnector → queryClient.fetchQuery writes to the same React Query cache key [connectionKey, connectorId]
useConnectionsForConnector is configured with cacheTime: 0 and staleTime: 0 (libs/designer/src/lib/core/queries/connections.ts line 97) → the cache write triggers a re-render with a new array reference (still [])
connections dependency in useEffect changes → effect fires again → loop repeats
- Each iteration calls
_getUniqueConnectionNameInApiHub which makes recursive getConnection API calls (returning 404)
Why Azure Portal mostly avoids this
Most Azure Portal connectors have connectionParameterSets (multi-auth), so autoCreateConnectionIfPossible exits synchronously at the connectorHasMultiAuth check (line 418) before reaching getUniqueConnectionName. The loop only affects connectors with single auth that have visible connection parameters.
Impact
- Many redundant
getConnections and getConnection (404) API calls per connection panel open
- For simple connectors (no visible params), multiple concurrent
createConnection PUT calls may fire
- Increased latency before the create connection panel appears
Proposed fix
Add a useRef re-entry guard to prevent concurrent invocations:
const isAutoCreatingRef = useRef(false);
useEffect(() => {
if (
selectedNodeId &&
connector &&
!connectionQuery.isLoading &&
!connectionQuery.isError &&
connections.length === 0 &&
!isAutoCreatingRef.current
) {
isAutoCreatingRef.current = true;
autoCreateConnectionIfPossible({
connector: connector as Connector,
referenceKeys: Object.keys(references),
operationInfo,
skipOAuth: true,
applyNewConnection: (connection: Connection) =>
dispatch(updateNodeConnection({ nodeId: selectedNodeId, connection, connector: connector as Connector })),
onSuccess: () => {
isAutoCreatingRef.current = false;
dispatch(closeConnectionsFlow({ nodeId: selectedNodeId }));
},
onManualConnectionCreation: () => {
isAutoCreatingRef.current = false;
dispatch(setIsCreatingConnection(true));
},
}).catch(() => {
isAutoCreatingRef.current = false;
});
}
}, [connectionQuery.isError, connectionQuery.isLoading, connections, connector, dispatch, operationInfo, references, selectedNodeId]);
### What type of Logic App Is this happening in?
Consumption (Portal)
### Are you experiencing a regression?
_No response_
### Which operating system are you using?
Windows
### Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg
Yes
### Workflow JSON
```json
Screenshots or Videos
No response
Environment
Edge
Additional context
No response
Severity
P2 - High (Major functionality broken)
Describe the Bug with repro steps
Describe the bug
The
useEffectinConnectionPanelcallsautoCreateConnectionIfPossiblewithout a re-entry guard, creating a loop that produces many redundant API calls when no connections exist for a connector.Steps to reproduce
connectionParameterSets), visible connection parameters, and an ARM resource IDgetConnectionsandgetConnection(404) API calls in the browser network tabRoot cause
File:
libs/designer/src/lib/ui/panel/connectionsPanel/connectionsPanel.tsx(line 33)ConnectionPanelmounts →useConnectionsForConnector(connectorId)returns[]useEffectseesconnections.length === 0→ firesautoCreateConnectionIfPossible()autoCreateConnectionIfPossible,getUniqueConnectionNamecallsgetConnectionsForConnector→queryClient.fetchQuerywrites to the same React Query cache key[connectionKey, connectorId]useConnectionsForConnectoris configured withcacheTime: 0andstaleTime: 0(libs/designer/src/lib/core/queries/connections.tsline 97) → the cache write triggers a re-render with a new array reference (still[])connectionsdependency inuseEffectchanges → effect fires again → loop repeats_getUniqueConnectionNameInApiHubwhich makes recursivegetConnectionAPI calls (returning 404)Why Azure Portal mostly avoids this
Most Azure Portal connectors have
connectionParameterSets(multi-auth), soautoCreateConnectionIfPossibleexits synchronously at theconnectorHasMultiAuthcheck (line 418) before reachinggetUniqueConnectionName. The loop only affects connectors with single auth that have visible connection parameters.Impact
getConnectionsandgetConnection(404) API calls per connection panel opencreateConnectionPUT calls may fireProposed fix
Add a
useRefre-entry guard to prevent concurrent invocations:Screenshots or Videos
No response
Environment
Edge
Additional context
No response