From d30d72ee88855b004b7a5050f44d7f0395d93d17 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 23 Jun 2022 23:13:12 +0200 Subject: [PATCH] Update elsa-dropdown-property.tsx --- .../elsa-dropdown-property/elsa-dropdown-property.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/designer/elsa-workflows-studio/src/components/editors/properties/elsa-dropdown-property/elsa-dropdown-property.tsx b/src/designer/elsa-workflows-studio/src/components/editors/properties/elsa-dropdown-property/elsa-dropdown-property.tsx index 8edb4d9810..de8cc17e51 100644 --- a/src/designer/elsa-workflows-studio/src/components/editors/properties/elsa-dropdown-property/elsa-dropdown-property.tsx +++ b/src/designer/elsa-workflows-studio/src/components/editors/properties/elsa-dropdown-property/elsa-dropdown-property.tsx @@ -108,8 +108,11 @@ export class ElsaDropdownProperty { this.currentValue = optionIsObject ? firstOption.value : firstOption.toString(); } - // Dispatch event to the next dependent input, if any. - currentSelectList.dispatchEvent(new Event("change")); + // Dispatch change event so that dependent dropdown elements refresh. + // Do this after the current component has re-rendered, otherwise the current value will be sent to the backend, which is outdated. + requestAnimationFrame(() => { + currentSelectList.dispatchEvent(new Event("change")); + }); } private awaitElement = async selector => {