Skip to content

Commit

Permalink
fix(Designer): Fixed issue where we weren't handling null connection …
Browse files Browse the repository at this point in the history
…references fully (#4596)

Fixed issue where we weren't handling null connection references fully

Co-authored-by: Travis Harris <hartra344@users.noreply.github.com>
  • Loading branch information
rllyy97 and hartra344 committed Apr 11, 2024
1 parent 0df2bf6 commit 62622f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions libs/designer/src/lib/core/actions/bjsworkflow/connections.ts
Expand Up @@ -394,8 +394,8 @@ export function needsSimpleConnection(connector: Connector): boolean {
}

export function needsConfigConnection(connector: Connector): boolean {
if (connector?.properties?.connectionParameters) {
const connectionParameters = connector.properties.connectionParameters;
const connectionParameters = connector?.properties?.connectionParameters;
if (connectionParameters) {
return Object.keys(connectionParameters)
.filter((connectionParameterKey) => !isHiddenConnectionParameter(connectionParameters, connectionParameterKey))
.some((connectionParameterKey) => {
Expand Down
4 changes: 2 additions & 2 deletions libs/designer/src/lib/core/actions/bjsworkflow/serializer.ts
Expand Up @@ -131,7 +131,7 @@ export const serializeWorkflow = async (rootState: RootState, options?: Serializ
}

const { connectionsMapping, connectionReferences: referencesObject } = rootState.connections;
const connectionReferences = Object.keys(connectionsMapping).reduce((references: ConnectionReferences, nodeId: string) => {
const connectionReferences = Object.keys(connectionsMapping ?? {}).reduce((references: ConnectionReferences, nodeId: string) => {
const referenceKey = getRecordEntry(connectionsMapping, nodeId);
if (!referenceKey || !referencesObject[referenceKey]) {
return references;
Expand All @@ -151,7 +151,7 @@ export const serializeWorkflow = async (rootState: RootState, options?: Serializ
$schema:
WorkflowService().getDefinitionSchema?.(unmap(rootState.operations.operationInfo)) ?? rootState.workflow.originalDefinition.$schema,
actions: await getActions(rootState, options),
...(Object.keys(rootState?.staticResults?.properties).length > 0 ? { staticResults: rootState.staticResults.properties } : {}),
...(Object.keys(rootState?.staticResults?.properties ?? {}).length > 0 ? { staticResults: rootState.staticResults.properties } : {}),
triggers: await getTrigger(rootState, options),
},
connectionReferences,
Expand Down
Expand Up @@ -11,7 +11,7 @@ import {
isServiceProviderOperation,
getRecordEntry,
type Connector,
Gateway
Gateway,
} from '@microsoft/logic-apps-shared';
import { useMemo } from 'react';
import { UseQueryResult, useQuery } from 'react-query';
Expand Down Expand Up @@ -117,7 +117,7 @@ export const useConnectionRefsByConnectorId = (connectorId?: string) => {

export const useIsOperationMissingConnection = (nodeId: string) => {
const connectionsMapping = useSelector((state: RootState) => state.connections.connectionsMapping);
return Object.keys(connectionsMapping).includes(nodeId) && getRecordEntry(connectionsMapping, nodeId) === null;
return Object.keys(connectionsMapping ?? {}).includes(nodeId) && getRecordEntry(connectionsMapping, nodeId) === null;
};

export const useShowIdentitySelectorQuery = (nodeId: string) => {
Expand Down
Expand Up @@ -615,7 +615,7 @@ function convertToServiceProviderConnectionsData(
? connectionParameterMetadata.connectionParameterSet?.parameters
: (connectionParameterMetadata.connectionParameters as Record<string, ConnectionParameter>);
const parameterValues = connectionParametersSetValues
? Object.keys(connectionParametersSetValues.values).reduce(
? Object.keys(connectionParametersSetValues?.values ?? {}).reduce(
(result: Record<string, any>, currentKey: string) => ({
...result,
[currentKey]: connectionParametersSetValues.values[currentKey].value,
Expand Down

0 comments on commit 62622f7

Please sign in to comment.