Page MenuHomePhabricator

Stop the UsersMultiselectWidget from running duplicate validation callbacks
Closed, ResolvedPublic

Description

When using validation-callback to implement a custom validation schema, UsersMultiselectWidget appears to run this callback twice per value (eg. T270634: Use UsersMultiselectWidget in SecurePoll create form). The second one should not occur.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@Tchanders I looked into this more and it looks like it's not actually duplicating the callback. The validation-callback function is being called as part of getErrorsRaw() which happens when the page instantiates. I think what we're seeing is when you try to add an invalid admin, it reloads the poll form (triggering getErrorsRaw()) and then also returns the result of the validation we actively requested. This "doubling up" doesn't happen if you successfully edit the poll (since the poll won't reload on the success page, we only see the active validation check).

If you agree, let's close this out?

@STran That makes sense, happy to close this - thanks.