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

App stops responding if a page redirects more than once on a cold boot #217

Closed
ghiculescu opened this issue Mar 1, 2022 · 0 comments · Fixed by #220
Closed

App stops responding if a page redirects more than once on a cold boot #217

ghiculescu opened this issue Mar 1, 2022 · 0 comments · Fixed by #220

Comments

@ghiculescu
Copy link
Contributor

ghiculescu commented Mar 1, 2022

If a navigation is proposed from the native layer after calling resetSession(), and there is more than 1 redirect involved, each of which happens within 500ms of the last, the app breaks. To replicate:

Watch this gif:

bug

When you click the web navigation link everything works fine (first click in the gif).

When you click the link with slow redirects, everything works fine (second click).

When you click the link that uses the native handler to propose navigation, the navigation fails (third click).

Workarounds

In terms of workarounds: if you don't call resetSesssions here, the issue is resolved. So the issue only happens when you're on a cold boot path. We need to call resetSessions because in some cases this redirect is been cross-domain and we need to allow that.

Another workaround is adding sleep(0.5) if platform.android? on the server side for this particular code path 😿

This is a hurting my brain, what's the issue?

If you:

  • Initiate a visit from the native layer
  • The visit redirects in less than 0.5s to page
  • Which redirects in less than 0.5s to another page
  • Then the last visit never happens and you're on a loading indicator forever

An example scenario:

  • Native layer sets up a session, then navigates to /after_login
  • /after_login redirects to /posts/current
  • /posts/current redirects to /posts/2022-03-08

Each of these redirects would need to complete in more than 500ms to avoid the issue.

Possible fix

It'll probably create other issues, but if you remove shouldProposeThrottledVisit or make it return true the issue is resolved. I'm not confident enough about that throttler's purpose to make a PR yet so wanted to get some feedback on the issue.

Another idea would be for shouldProposeThrottledVisit to only happen if there's two attempted to clicks to the same location, not different ones as is the case here.

@ghiculescu ghiculescu changed the title Bug if a page redirects more than once on a cold boot App stops respoding if a page redirects more than once on a cold boot Mar 1, 2022
@ghiculescu ghiculescu changed the title App stops respoding if a page redirects more than once on a cold boot App stops responding if a page redirects more than once on a cold boot Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant