Skip to content

Commit

Permalink
fix(Designer): Fixed Consumption split on issue (#4206)
Browse files Browse the repository at this point in the history
Fixed issue coming from workflow kind on consumption workflows being set to stateless
  • Loading branch information
rllyy97 committed Feb 15, 2024
1 parent 360405e commit 547faaf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 2 additions & 3 deletions libs/designer/src/lib/core/BJSWorkflowProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { ProviderWrappedContext } from './ProviderWrappedContext';
import { initializeGraphState } from './parsers/ParseReduxAction';
import { useAreDesignerOptionsInitialized, useAreServicesInitialized } from './state/designerOptions/designerOptionsSelectors';
import { initializeServices } from './state/designerOptions/designerOptionsSlice';
import { WorkflowKind } from './state/workflow/workflowInterfaces';
import { initWorkflowKind, initRunInstance, initWorkflowSpec } from './state/workflow/workflowSlice';
import type { AppDispatch } from './store';
import { parseWorkflowKind } from './utils/workflow';
import type { LogicAppsV2 } from '@microsoft/utils-logic-apps';
import { equals } from '@microsoft/utils-logic-apps';
import { useDeepCompareEffect } from '@react-hookz/web';
import React, { useContext, useEffect } from 'react';
import { useDispatch } from 'react-redux';
Expand All @@ -22,7 +21,7 @@ const DataProviderInner: React.FC<BJSWorkflowProviderProps> = ({ workflow, child
const dispatch = useDispatch<AppDispatch>();
useDeepCompareEffect(() => {
dispatch(initWorkflowSpec('BJS'));
dispatch(initWorkflowKind(equals(workflow?.kind, 'stateful') ? WorkflowKind.STATEFUL : WorkflowKind.STATELESS));
dispatch(initWorkflowKind(parseWorkflowKind(workflow?.kind)));
dispatch(initRunInstance(runInstance ?? null));
dispatch(initializeGraphState({ workflowDefinition: workflow, runInstance }));
}, [runInstance, workflow]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const WorkflowKind = {
STATEFUL: 'stateful',
STATELESS: 'stateless',
} as const;
export type WorkflowKind = (typeof WorkflowKind)[keyof typeof WorkflowKind];
export type WorkflowKind = (typeof WorkflowKind)[keyof typeof WorkflowKind] | undefined;

export type ErrorMessage = {
nodeId: string;
Expand Down
5 changes: 2 additions & 3 deletions libs/designer/src/lib/core/state/workflow/workflowSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import {
updateStaticResults,
} from '../operation/operationMetadataSlice';
import type { RelationshipIds } from '../panel/panelInterfaces';
import type { ErrorMessage, SpecTypes, WorkflowState } from './workflowInterfaces';
import { WorkflowKind } from './workflowInterfaces';
import type { ErrorMessage, SpecTypes, WorkflowState, WorkflowKind } from './workflowInterfaces';
import { getWorkflowNodeFromGraphState } from './workflowSelectors';
import { LogEntryLevel, LoggerService } from '@microsoft/designer-client-services-logic-apps';
import type { MessageLevel } from '@microsoft/designer-ui';
Expand All @@ -40,7 +39,7 @@ export interface AddImplicitForeachPayload {

export const initialWorkflowState: WorkflowState = {
workflowSpec: 'BJS',
workflowKind: WorkflowKind.STATELESS,
workflowKind: undefined,
graph: null,
runInstance: null,
operations: {},
Expand Down
8 changes: 8 additions & 0 deletions libs/designer/src/lib/core/utils/workflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { WorkflowKind } from '../state/workflow/workflowInterfaces';
import { equals } from '@microsoft/utils-logic-apps';

export const parseWorkflowKind = (kind?: string): WorkflowKind => {
if (equals(kind, 'stateful')) return WorkflowKind.STATEFUL;
if (equals(kind, 'stateless')) return WorkflowKind.STATELESS;
return undefined;
};

0 comments on commit 547faaf

Please sign in to comment.