Dynamic select options doesnt remember selected value
Hello,
I got a dropdown field with 3 options. Depending on another option, it can become 5 options. When the dropdown changes from 3 to 5 or 5 to 3 options, it doesnt select the choice of the client, it remembers the clicked index of the dropdown. So for example
10 => England
20 => Germany
30 => France
I select for example Germany which has a ID of 20. Now im selecting a condition in my form so 2 more countries are added:
1 => Canada
5 => Spain
10 => England
20 => Germany
30 => France
The expected behavior should be that Germany remains selected as it is in the list with options, but what happens is that Spain gets selected as it contains the second position.
The afterStateUpdate doesnt work in this case as the state of my dropdown isn't changing
1 Reply
Could you share some code 🙂