New options index was not referring to the react hook form field array. addOption should be referring to options instead of field.options, which is only updated after each save. Therefore, radio and checkbox options that have more than three options would not work as the index will always be 1 for all new option since field.options is still the same length.
To reproduce on production:
Create a new check with 3 radio option
Create a result that has returns the value of the radio question
Select the third option
Notice that when the third option is selected, the second option is also selected.
This only affect checkers that tried to add an option after the block validation feature as introduced.
Solution
Bug Fixes:
Reference options from react hook form for radio and checkbox questions.
Tests
[ ] Create a new checker with 3 radio options. Check that the values/index are correct for each of them. Use a calculated result to print the selected option to verify
[ ] Create a new checker with 3 checkbox options. Check that the values/index are correct for each of them. Use a calculated result to print the selected option to verify
Problem
New options index was not referring to the react hook form field array.
addOption
should be referring tooptions
instead offield.options
, which is only updated after each save. Therefore, radio and checkbox options that have more than three options would not work as the index will always be1
for all new option sincefield.options
is still the same length.To reproduce on production:
This only affect checkers that tried to add an option after the block validation feature as introduced.
Solution
Bug Fixes:
options
from react hook form for radio and checkbox questions.Tests