0

I have a react app that loads multiple components on the page. Each component is authenticated before it is rendered.

https://github.com/amjith/simple-react-app

The authentication is done via Firebase using a decorator that I wrote:

https://github.com/amjith/simple-react-app/blob/master/login-decorator.js

It is used as follows:

https://github.com/amjith/simple-react-app/blob/master/small-component.js#L4

But when I load the page only one of the component renders and the other component says it is still loading. The promise that was returned by firebase.authWithCustomToken() never resolves for the component that is unrendered.

If firebase api sdk is doing some caching then it should at least honor all the callbacks and resolve the promises.

I wonder why this isn't working.

Amjith
  • 22,626
  • 14
  • 43
  • 38
  • How many simultaneous requests to that domain you have? Is the request for the widget that is not resolved even sent? Is the response received? – zerkms May 06 '16 at 03:36
  • There can be at most one pending auth request. Starting a second request while one is still pending, will cancel the first request. If that doesn't explain the behavior you see, provide an MCVE in the question please. – Frank van Puffelen May 06 '16 at 03:44
  • See http://stackoverflow.com/questions/32372396/multiple-custom-authentication-requests-to-firebase-failing – Frank van Puffelen May 06 '16 at 04:30
  • @FrankvanPuffelen You're right. I was loading multiple widgets in the page and each one would fire off a auth request to firebase. I wanted a way to authenticate before rendering it. The github link is a mcve react app that can reproduce this issue. – Amjith May 06 '16 at 18:32

0 Answers0