Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Success handler of fetch is not called when response is synchronous (and fetchQueue is empty) #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaReiser
Copy link
Contributor

In the fetchQueue method a new queue is created when no one exists. Additionally the success and error callbacks are overridden to point to flushQueue. When super ($super.call) is called, the fetch queue is still empty. When the super.call now resolves the success handler synchronous (no defer or anything), then at the moment where flushQueue is called, the queue is still empty, and the success or error handler are not called (because the queue is empty)

A simple solution could be, that super will be invoked using _.defer. Otherwise the registration in the flushQueue must take place before invoking super...

@MichaReiser
Copy link
Contributor Author

I have added a unit test that shows the issue. Either I still don't know how a fix can be implemented.
The only possibility I see (but I don't know if this would be conform with the api) is to pass the original success function to flushQueue. If the fetchQueue is empty in flushQueue, then call the original success function. Otherwise use the existing logic.
Any ideas?

@liorcode
Copy link
Contributor

I'm facing the same issue, any progress on that?

@CLAassistant
Copy link

CLAassistant commented Jul 12, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants