Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(designer): Add ignore dirty prop to updateNodeSettings action #6224

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/designer/src/lib/core/actions/bjsworkflow/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export const initializeOperationDetails = async (

if (triggerNodeManifest) {
updateInvokerSettings(isTrigger, triggerNodeManifest, initData.settings as Settings, (invokerSettings: Settings) =>
dispatch(updateNodeSettings({ id: nodeId, settings: invokerSettings }))
dispatch(updateNodeSettings({ id: nodeId, settings: invokerSettings, ignoreDirty: false }))
);
}

Expand Down
8 changes: 7 additions & 1 deletion libs/designer/src/lib/core/actions/bjsworkflow/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,13 @@ export const updateOutputsAndTokens = async (
if (shouldProcessSettings && operationSupportsSplitOn(isTrigger)) {
const hasSplitOnOptions = getSplitOnOptions(nodeOutputs, supportsManifest).length > 0;
if (settings.splitOn?.isSupported !== hasSplitOnOptions) {
dispatch(updateNodeSettings({ id: nodeId, settings: { splitOn: { ...settings.splitOn, isSupported: hasSplitOnOptions } } }));
dispatch(
updateNodeSettings({
id: nodeId,
settings: { splitOn: { ...settings.splitOn, isSupported: hasSplitOnOptions } },
ignoreDirty: true,
})
);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export interface NodeData {
interface AddSettingsPayload {
id: string;
settings: Settings;
ignoreDirty: boolean;
ccastrotrejo marked this conversation as resolved.
Show resolved Hide resolved
}

interface AddStaticResultsPayload {
Expand Down
6 changes: 5 additions & 1 deletion libs/designer/src/lib/core/state/workflow/workflowSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ export const workflowSlice = createSlice({
nodeMetadata.runData = nodeRunData as LogicAppsV2.WorkflowRunAction;
});
builder.addCase(setStateAfterUndoRedo, (_, action: PayloadAction<UndoRedoPartialRootState>) => action.payload.workflow);
builder.addCase(updateNodeSettings, (state, action) => {
if (!action.payload.ignoreDirty) {
state.isDirty = true;
}
});
builder.addMatcher(
isAnyOf(
addNode,
Expand All @@ -541,7 +546,6 @@ export const workflowSlice = createSlice({
removeEdgeFromRunAfter,
addEdgeFromRunAfter,
replaceId,
updateNodeSettings,
updateNodeConnection.fulfilled,
updateStaticResults,
updateParameterConditionalVisibility
Expand Down
2 changes: 2 additions & 0 deletions libs/designer/src/lib/ui/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const SettingsPanel: React.FC<PanelTabProps> = (props) => {
updateNodeSettings({
id: selectedNode,
settings,
ignoreDirty: false,
})
);
if (shouldValidateSetting) {
Expand Down Expand Up @@ -339,6 +340,7 @@ function GeneralSettings({
value: { value: invokerConnection?.value?.value, enabled: checked },
},
},
ignoreDirty: false,
})
);
};
Expand Down
Loading