From 6366dc344a239a24c65f8c6c829a43353e0243d6 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula <123897612+bhapas@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:09:38 +0200 Subject: [PATCH] [Automatic Import] Fix deploy error after editing the pipeline (#194203) ## Release Note Fixes a bug that is causing the deploy step to fail after a pipeline edit/save. ## Summary #190407 introduced a bug that deployment fails when a pipeline is edited and saved in the review step. The issue is that after the edit pipeline flow is executed the review step's result is overridden and `samplesFormat` is removed which if not present [the `useEffect` in Deploy step](https://github.com/elastic/kibana/blob/main/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/use_deploy_integration.ts#L41) fails. This PR fixes the issue by saving the `samplesFormat` that is present in the original result before the edit pipeline flow is executed there by having samplesFormat in the result. --- .../create_integration_assistant/state.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/state.ts b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/state.ts index bef5b35624df4f..99f95a3eee0393 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/state.ts +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/state.ts @@ -51,7 +51,11 @@ export const reducer = (state: State, action: Action): State => { case 'SET_IS_GENERATING': return { ...state, isGenerating: action.payload }; case 'SET_GENERATED_RESULT': - return { ...state, result: action.payload }; + return { + ...state, + // keep original result as the samplesFormat is not always included in the payload + result: state.result ? { ...state.result, ...action.payload } : action.payload, + }; default: return state; }