Skip to content
Discussion options

You must be logged in to vote

Good question! Every time the query input changes, the query is immediately fetched. The first thing that comes to mind is that you need to "debounce" the query input argument. Possibly with https://github.com/xnimorz/use-debounce.

Btw, in your query resolver, you will want to return a promise that you manually resolve inside the res.on("end" handler. As is, it may not work as expected. (or use a different fetcher that uses async/await like https://github.com/sindresorhus/got) Also, is that useState in your resolver from react? If so you shouldn't use it here because the query resolver is outside of react.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@spidertwin2
Comment options

@flybayer
Comment options

@spidertwin2
Comment options

@flybayer
Comment options

@spidertwin2
Comment options

Answer selected by spidertwin2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants