shakacode / re-formality

Form validation tool for reason-react
https://re-formality.now.sh
MIT License
244 stars 35 forks source link

Generalize payload of `FormStatus.SubmissionFailed` constructor #49

Closed alex35mil closed 5 years ago

alex35mil commented 5 years ago

Fixes #48

baransu commented 5 years ago

Whats the use case of: mapSubmissionError? When would you like to map submission error?

alex35mil commented 5 years ago

Whats the use case of: mapSubmissionError? When would you like to map submission error?

@baransu I usually animate server errors and it requires additional movements to persist error data on a screen while unmounting. So my animated error type looks like this:

type submissionError = {
  error: Api.Error.t(CreatePasswordResetTokenMutation.Error.t),
  shown: bool,
};

And I map it to flip shown flag before removal from state to trigger unmounting animation when user dismisses error.

baransu commented 5 years ago

Got it, thanks!

For me this change is really good 🙂