Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brainstorm for all dev consumers: onResolve/onHandleSubmission prop? #5

Open
Noitidart opened this issue Apr 20, 2019 · 0 comments
Open

Comments

@Noitidart
Copy link

Noitidart commented Apr 20, 2019

This is a food for thought for all devs that use this. If my form is mounted, and it resolves, then I want to navigate to the next screen. So currently I am abusing the getPayload prop for this behavior:

getPayload={handleSubmission}
const handleSubmission = payload => {
    setTimeout(() => {
        // payload is undefined for success, else its SubmissionErrors for final-form
        if (payload === undefined) { 
            navigate('ScreenAfterLogin');
        }
    }, 0);
}

I don't navigate from redux, because after the login flow its not always necessary to navigate('ScreenAfterLogin'). For instance, if during the user using the app, his cookie expires, I show a "relogin screen", and on success there I send him navigation.back().

Aside: I am guessing I have to wrap in setTimeout, so I let the form take the changes, otherwise i get component is not mounted anymore errors.

@Noitidart Noitidart changed the title Brainstorm for all dev consumers: onResolve prop? Brainstorm for all dev consumers: onResolve/onHandleSubmission prop? Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant