From 50bc14c39faac6a267bb173b69d8e7a609cceade Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Wed, 13 Jul 2022 13:02:24 +0200 Subject: [PATCH] Fix initial input transform (#198) --- frontend/src/lib/components/flows/utils.ts | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/src/lib/components/flows/utils.ts b/frontend/src/lib/components/flows/utils.ts index 69d2d6ddd4..6b227f3bed 100644 --- a/frontend/src/lib/components/flows/utils.ts +++ b/frontend/src/lib/components/flows/utils.ts @@ -141,16 +141,23 @@ export async function loadSchemaFromModule(module: FlowModule): Promise<{ } const keys = Object.keys(schema?.properties ?? {}) - const inputTransform = keys.reduce((accu, key) => { - accu[key] = { - type: 'static', - value: '' - } - return accu - }, {}) + let input_transform = module.input_transform + + if ( + JSON.stringify(Object.keys(schema?.properties ?? {}).sort()) !== + JSON.stringify(Object.keys(module.input_transform).sort()) + ) { + input_transform = keys.reduce((accu, key) => { + accu[key] = { + type: 'static', + value: '' + } + return accu + }, {}) + } return { - input_transform: inputTransform, + input_transform: input_transform, schema: schema ?? emptySchema() } }