Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch middleware causes the last request to be canceled in a successive series of requests (e.g. auto-complete) #67

Open
joelvh opened this issue Jun 7, 2019 · 1 comment

Comments

@joelvh
Copy link
Contributor

joelvh commented Jun 7, 2019

We just implemented the batch middleware, and are experiencing a case where our auto-complete queries don't show a result because all requests were canceled (e.g. when someone types really fast, React makes a request on each key press, so that can add up to many queries that are issued and canceled until the last one completes).

When there is a series of requests, it makes sense that any previous (incomplete) requests would be canceled before making the same request again. However, with the batch middleware, even the last request is canceled (and no final request is made).

My guess is this is related to the setTimeout used to collect requests to batch. When it's just one query, even though it should process that query as if it wasn't batched, there is still some sort of timing issue.

Thoughts on what might cause that?

@joelvh
Copy link
Contributor Author

joelvh commented Jun 11, 2019

@nodkz it looks like maybe much of this is from the Relay Classic version of this package. The canceling of active requests was added recently, right? Seems like there is a slight timing issue with these two functions at the moment.

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

No branches or pull requests

1 participant