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.

User authentication race condition?

See original GitHub issue

So, I’m trying to setup a protected chain of routes. Right now the chain of routes is in a parent component that has an onEnter function that checks for user existance:

<Route component={Me} onEnter={requireViewer} path="me">

It looks like this:

  const requireViewer = (nextState, replace) => {
    if (getState().users.viewer) return;
    replace({
      pathname: '/signin',
      state: { nextPathname: nextState.location.pathname },
    });
  };

The problem is that the state seems to only have any info about the user about a second after the app finished rendering.

What’s the “este” way to do this?

@tarkanlar

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
rkobergcommented, Aug 22, 2016

I, as usual, do not understand your comments.(take for what it is worth, I think your kung foo is good) Don’t know if this is a lang barrier or just “the way you want it”. No, general comments spinkled throughout the code base do not make for good design. Please clarify in a clear way that is clear and clarified.

0reactions
steidacommented, Aug 22, 2016

Feel free to open new issue, but I really don’t have time for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How we found and fixed a rare race condition in our session ...
This bug required very specific conditions: a background thread, shared exception context between the main thread and the background thread, ...
Read more >
How to Prevent Race Conditions in Web Applications - Kroll
As per the OWASP testing guide, “A race condition is a flaw that produces an unexpected result when the timing of actions impact...
Read more >
What is a Race Condition? - Veracode
Race condition attacks (also called Time of Check to Time of Use, or TOCTTOU attacks) take advantage of the need that computing systems...
Read more >
Race Condition - HackTricks
Race conditions are vulnerabilities that appear in webs that limit the number of ... an application and authenticate users that the provider has...
Read more >
What is a Race Condition? - TechTarget
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
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