question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unclear how to sign out without hooks

See original GitHub issue

Our project was using AppAuth-JS library before discovering this. It is much more succinct and sensible so thank you.

One of the challenges faced in using this library: we are using Apollo client to make GraphQL requests and we use a link to detect 401 errors. From the link, it’s not clear how one could trigger a signout redirect. Thus, as a workaround, a boolean flag needsSignoutRedirect was created in our redux store which gets picked up by a React hook which performs the signout.

How can one halt all rendering while the page redirects though? If the network error reaches the query hook, the page will display an error message momentarily. Throwing an error in the link and catching it in the error boundary in order to halt the rendering cycles could prevent the hook from catching the needsSignoutRedirect flag.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kherockcommented, Apr 4, 2022

Actually, I take that back. Two user managers should be able to operate next to each other as long as they aren’t racing with each other for certain global resources. I think the only instances where this may come up is when waiting for a popup window or silent iframe to respond.

1reaction
kherockcommented, Apr 4, 2022

You would have to create another UserManager, but I think providing an easy way of obtaining a handle to the context without creating a child component is the better solution here. UserManager instances don’t talk to each other, so some things would fall out of sync. This is kind of related to #292.

If you have time to open a PR adding an imperative handle to AuthProvider, I’d appreciate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Script on Logout Without Use of Logout Hook - Ask Different
All you need to do is launch that script using a RunAtLoad launch agent or launch daemon and it will run at log-out...
Read more >
How can we efficiently handle the react google logout process ...
I am using react-google-login for login into my react hooks web app. While logging out from the system, it is navigating to the...
Read more >
Not sure how to test call to REST hook, documentation unclear
I'm trying to set up a REST Hook api request. I can trigger the hook, but nothing happens. Maybe something goes wrong in...
Read more >
React Hook "useABC" is called in function "xYZ ... - GitHub
Actual Behavior. Failed to compile. Error message is not clear. It makes developer confused and don't know how to resolve.
Read more >
Introducing Hooks - React
They let you use state and other React features without writing a class. ... idea of what problems Hooks are solving, but many...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found