-
My changes are in lines 291, 292, 304, 331, 343. I basically added a ref to the select to keep track if the selected id, if there was none (the default option has value undefined cause its out of the .map) then I added a second case in the disabled prop.
Edited by Lia Papailiou -
This is one way to do it, but it duplicates logic. I was hoping to align this behavior with the validation we do in the action. When the form is submitted it returns an error; when that error is not a
ConflictingSkillsError
we are unable to submit a valid copy action and could thus disable the confirm button. Doing something like that would prevent having to separately code-up all validation logic in our frontend state.This probably means we have to call validate() not onChange but on another trigger.
-
I changed this to match your validation errors: it starts in line 132, 153, 320, 352 and 388. So basically if the target client doesn't exist or is empty it throws a validation error.
I feel that combined with the warning this works quite well, but let me know what else I can do better.
-
That's a good improvement already! I still have something nitpick about;
CopyAction.decode
is actually already doing the validation you're doing on line 153-4; alongside checking some other fields. Those errors end up in the first foldW callback, directly beneath it. It would be nice to re-use those errors. Perhaps they can be wrapped in a ValidationErrors type, or something like that, to have something to check on in our Modal component.If you think this is a bridge too far, it's also oke to leave it like this.
Please register or sign in to comment