only try to fetch institutions list and "self" once
Testing notes: in order to show the problem this PR addresses, one needs to arrange for the lookupproxy to fail. This can be done by downloading a little test script, corsdevserver.py which can replace the lookupproxy. Run via:
docker-compose stop lookupproxy && python2 corsdevserver.py
. Without this PR applied, the browser should get stuck in a reload loop for the user's profile.
As noted in #77 (closed), if fetching the user's profile fails, we get stuck in a loop where the browser tries again and again, hammering the browser.
For both the user's profile and the list of instututions, record a "requestedAt" date which records when the last request was in flight. We then only try to load the corresponding resource if:
- There is not a resource loaded, and
- There is not a request in flight, and
- There had not been a request previously.
Number 3 was lacking from our logic before meaning that there was no "memory" of having tried to request the user's profile or list of institutions.
Closes #77 (closed)