Skip to content
  • Lia Papailiou @LiaPapailiou ·

    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.

  • Lia Papailiou @LiaPapailiou ·

    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.

  • Lia Papailiou @LiaPapailiou ·

    Is this more in line with what you thought? I see that the errors can also contain a message so I allowed for it to be passed within the ValidationError. Lines changed ad 147 for the Error extension and 171 to 179

  • This looks good! Probably need to do something about the different approach in ConflictingSkillsError, which is not class based, but that's something for the cleanup part.

  • Lia Papailiou @LiaPapailiou ·

    great will push shortly and then think about the ConflictingSkillsError, so we can align them a bit.

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment