Fix race condition on stripe subscription (#9629)

Fixes https://github.com/twentyhq/core-team-issues/issues/191
- remove automatic redirection on payment success page when subscription
status is undefined
- add an effect component to refresh the subscription status on payment
success page

Observation: Locally, I had to delay the stripe webhook subscription
created endpoint by 7s to see race condition issue


https://github.com/user-attachments/assets/463e1816-34fd-4c4f-b590-3994a3a3e91a
This commit is contained in:
martmull
2025-01-15 16:08:34 +01:00
committed by GitHub
parent d63aec44bb
commit c01e3af8ee
3 changed files with 47 additions and 10 deletions

View File

@ -42,7 +42,8 @@ export const usePageChangeEffectNavigateLocation = () => {
if (
onboardingStatus === OnboardingStatus.PlanRequired &&
!isMatchingLocation(AppPath.PlanRequired)
!isMatchingLocation(AppPath.PlanRequired) &&
!isMatchingLocation(AppPath.PlanRequiredSuccess)
) {
return AppPath.PlanRequired;
}