From c5097c27fcc2b36935a1bc4219eb552849cdc0b7 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Sun, 24 Jul 2022 14:28:24 -0700 Subject: [PATCH] explicitly set active field by default --- web/app/cad/craft/wizard/components/form/Form.tsx | 5 +---- web/app/cad/craft/wizard/wizardPlugin.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/web/app/cad/craft/wizard/components/form/Form.tsx b/web/app/cad/craft/wizard/components/form/Form.tsx index 6478c788..2c92b087 100644 --- a/web/app/cad/craft/wizard/components/form/Form.tsx +++ b/web/app/cad/craft/wizard/components/form/Form.tsx @@ -52,10 +52,7 @@ export function attachToForm(Control): any { const fullPath = [...formPath, name]; const fullPathFlatten = flattenPath(fullPath); - const onChange = value => { - console.log(fullPath + " : " + value); - formEdit.onChange(fullPath, value); - } + const onChange = value => formEdit.onChange(fullPath, value); const setActive = (isActive) => formEdit.setActive(fullPathFlatten, isActive); const value = params[name]; diff --git a/web/app/cad/craft/wizard/wizardPlugin.ts b/web/app/cad/craft/wizard/wizardPlugin.ts index 7756c3d2..45fa8c46 100644 --- a/web/app/cad/craft/wizard/wizardPlugin.ts +++ b/web/app/cad/craft/wizard/wizardPlugin.ts @@ -91,17 +91,16 @@ export function activate(ctx: ApplicationContext) { disposerList = createFunctionList(); } - if (curr !== null && old?.requestKey !== curr.requestKey) { - const newState: WizardState = {}; - if (curr) { - const op = ctx.operationService.get(curr.type); - if (op.defaultActiveField) { - newState.activeParam = op.defaultActiveField; - } + const newState: WizardState = {}; + + if (curr) { + const op = ctx.operationService.get(curr.type); + if (op.defaultActiveField) { + newState.activeParam = op.defaultActiveField; } - state$.next(newState); } + state$.next(newState); }) const updateParams = mutator => workingRequest$.update((req: WorkingRequest) => produce(req, draft => {