sharetribe / web-template

Sharetribe Web Template - starting point to create a client app to your marketplace
Other
31 stars 136 forks source link

Fix email verification not fetching current user #451

Closed Gnito closed 2 months ago

Gnito commented 2 months ago

When user clicks verify email button on email they received, browser opens the example.com/verify-email?t=1234 link.

1) CSR: app is hydrated and fetchCurrentUser is fetched 2) EmailVerificationPage: loadData calls verify thunk function a) sdk.currentUser.verifyEmail is called first b) and then fetchCurrentUser.

Recently, we removed double calls to fetchCurrentUser, by applying a small buffer, when subsequent calls to fetchCurrentUser actually make the call. (This can happen on pages that needs to fetch currentUser inside their loadData function).

Unfortunately, it was forgotten that email verification has a requirement for the order of those calls: (verify call first, and fetchCurrentUser second). This PR enforces the call of fetchCurrentUser on EmailVerificationPage.