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

Redirect not work on browser refresh #17

Open
sjoonk opened this issue Sep 5, 2018 · 4 comments
Open

Redirect not work on browser refresh #17

sjoonk opened this issue Sep 5, 2018 · 4 comments

Comments

@sjoonk
Copy link

sjoonk commented Sep 5, 2018

Very useful component, thank you.

In the Redirection example on the Readme Doc,
https://github.com/hasura/react-check-auth#3-redirect-not-logged-in-users-to-login

If I just use Browser history router, it works well.
But if I refresh the browser the example code not work, because #setState() methods called 3 times.
First on initial rendering, second on toggleLoading(), and finally on fetchSuccess()/ Fail().
The UserInfo is null when initial rendering, so the example code trigger redirection to login url.

I think some other property is required that distinguish between initial rendering and the last rendering to solve this problem.

Thanks.

@tsonev7
Copy link

tsonev7 commented Sep 16, 2018

I have the same issue and I fixed it by creating a fork of the project and set the isLoading property default value to True.

@ducanh2110
Copy link

I have them same problem with you guys, but with your solution when we use it production server, i need to do the same? @tsonev7

@arzke
Copy link

arzke commented Nov 13, 2018

@tsonev7 Can you please do a pull request for this?

@tsonev7
Copy link

tsonev7 commented Jan 3, 2019

@brundozer I can, but I am not sure if this is the expected behaviour :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants