reactioncommerce / reaction

Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
https://mailchimp.com/developer/open-commerce/
GNU General Public License v3.0
12.34k stars 2.17k forks source link

Weird behavior on checkout login/signup #2328

Closed kieha closed 6 years ago

kieha commented 7 years ago

This happens when logging in/signing up on the checkout panel.

Expected behavior

Scenario A

When logging in/signing up and I have entered the wrong credentials, an error message should pop up on the form.

Scenario B

When logging in/signing up and I have the correct credentials, I should be redirected back to the checkout panel immediately to continue filling out the checkout steps.

Actual Behavior

Scenario A

When logging in/signing up and I have entered the wrong credentials, the Unauthorized page pops up for a moment, then redirects back to the checkout page without displaying the error message on the form.

Scenario B

When logging in/signing up and I have the correct credentials, the Unauthorized page pops up for a moment, then the Your cart is empty page displays, then finally it redirects back to the checkout page.

Steps to Reproduce the Behavior

Versions

Node: 6.2.2 NPM: 3.10.9 Meteor Node: 4.8.2 Meteor NPM: 4.5.0 Reaction CLI: 0.8.3 Reaction: 1.2.0 Reaction branch: development Docker: 1.13.0

aaronjudd commented 7 years ago

@mikemurray sounds like react router? however, we've had a similar behavior when the guest logins in the past as well... where you see "oops your cart is empty" right after login, and then the cart loads..

mikemurray commented 7 years ago

@aaronjudd @kieha The part about there being no error on wrong credentials was happening before React Router.

The second part is most likely React Router. When signing in the routes are re-rendered with updated permissions, and there's a moment where you have no permissions until the subscription is updated.

This update on login is how it used to work with Flow Router. We may have to think of a better approach for React Router.

aaronjudd commented 7 years ago

@mikemurray @kieha is this still a valid issue in 1.3.0?

kieha commented 7 years ago

@aaronjudd I've just tried reproducing it on 1.3.0 and it still happens, but the unauthorized page no longer shows up.

desaawa commented 7 years ago

Update I found this to be cause by the login component here being re-mounted when the sign in button is clicked. So when you click with the wrong credentials it tries to set the state with form errors when the component has already unmounted, and by the time it has mounted again, the form errors are no more in state to set. Not sure what exactly is causing it to be unmounted and mounted again. I am pausing on this to finish up my other task on foray.

aaronjudd commented 7 years ago

@awadesmoline is this in progress?

desaawa commented 7 years ago

Yeah @aaronjudd, got stumped, but I'm getting back on it now since I finished up other tasks.

rymorgan commented 7 years ago

This is very much still happening. In fact, I can't register as a new user at all.

Might be related to: https://github.com/reactioncommerce/reaction/issues/2931

register user

aaronjudd commented 6 years ago

@zenweasel this should be reviewed, and prioritized in for @reactioncommerce/community

prinzdezibel commented 6 years ago

Can't reproduce scenario B. Works as expected when signing in or registering as new user. During user creation/login, the screen gets white for a couple of seconds, but aside from that, it works ok.

prinzdezibel commented 6 years ago

Bug description for scenario A still holds true partially. When entering wrong credentials, the Unauthorized template is not shown any more, but there's still no error message displayed.

prinzdezibel commented 6 years ago

Moved to Ready via : https://github.com/reactioncommerce/reaction/pull/3664

prinzdezibel commented 6 years ago

Was merged. Going to close.