Ignas
Ignas

Reputation: 21

Handling Infinite Spinner on Browser Back After PayPal Redirect in React Checkout

I’m working on a React checkout page where after clicking the PayPal submit button, I get a 3-second loading spinner, and then I am redirected to the PayPal site. However, when I click the browser’s back button to return to the checkout page, I encounter an issue where the page is stuck with an infinite spinning loader and an overlay that prevents interaction.

I’m currently using templateContext?.isLoading boolean to control the loading state, but I want to avoid reloading the page when navigating back. Ideally, I’d like to set isLoading to false if the previous page was the PayPal redirect page, instead of reloading the entire page.

My main goal is to find a solution to track the previous page (for example, check if it was PayPal) and either stop the loading spinner or prevent the overlay from blocking interaction without reloading the page.

Has anyone faced a similar issue or know of a way to handle this in React?

Upvotes: 0

Views: 37

Answers (0)

Related Questions