You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, in case the request response is not received yet, do not issue a new (network) request. Wait for the one which is still pending.
Here's a test for this (kind of extreme) use-case:
it('Should wait if there is a Promise pending and should NOT fire another one',done=>{letnetworkRequestsCount=0;constrepo=newSuperRepo({storage: 'LOCAL_VARIABLE',name: 'test',outOfDateAfter: 1000,// 1 secondrequest: ()=>{networkRequestsCount++;returnnewPromise(resolve=>{clock.tick(10*1000);resolve('whatever');});}});repo.initSyncer().then(()=>{expect(networkRequestsCount).to.equal(1);clock.tick(15*1000);expect(networkRequestsCount).to.equal(2);}).then(done,done);});
The text was updated successfully, but these errors were encountered:
Basically, in case the request response is not received yet, do not issue a new (network) request. Wait for the one which is still pending.
Here's a test for this (kind of extreme) use-case:
The text was updated successfully, but these errors were encountered: