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

userQuery with pause=true still issues an initial request #300

Closed
Cooke opened this issue Jun 13, 2019 · 8 comments
Closed

userQuery with pause=true still issues an initial request #300

Cooke opened this issue Jun 13, 2019 · 8 comments
Labels
needs more info ✋ A question or report that needs more info to be addressable

Comments

@Cooke
Copy link

Cooke commented Jun 13, 2019

I have a search query that I want to execute as soon as something has been entered into a input field so I use "useQuery" with pause: input != "". Though a query is still being issues on mount even though pause is true.

@kitten
Copy link
Member

kitten commented Jun 13, 2019

We have tests and strong guarantees around this and in our hook we return very early when pause is true.

Can you check whether pause is really set as expected? And can you maybe provide a reproduction on CodeSandbox or something else please that demonstrates this? That's be very helpful to investigate this and make sure it's reproducible 👍

@kitten kitten added the needs more info ✋ A question or report that needs more info to be addressable label Jun 13, 2019
@kitten
Copy link
Member

kitten commented Jun 18, 2019

I tried this out and unfortunately can't reproduce it. I'll close this issue due to inactivity but if you have more details we can reopen it 🙌

Maybe you had a timing issue in your code or sth that flips pause to false temporarily?

@narinluangrath
Copy link
Contributor

Hey @kitten, I think the pause argument might be broken in the latest version. It works in Urql 1.1.1 but breaks in the latest version. To repro checkout https://codesandbox.io/s/silent-pine-562mu and switch between 1.1.1 and latest. By the way this pause feature is awesome! Helps us avoid conditional rendering :)

@JoviDeCroock
Copy link
Collaborator

@narinluangrath thanks for the awesome reproduction, this lead to a quick find.

@kitten
Copy link
Member

kitten commented Jun 18, 2019

@JoviDeCroock @narinluangrath I'll release another patch in an hour or two 👍

@kitten
Copy link
Member

kitten commented Jun 18, 2019

@narinluangrath Sorry again about this! 1.1.3 has been published with the above fix in #315 and a test has been added to prevent this regression from reoccurring.

@ifokeev
Copy link

ifokeev commented Jul 18, 2019

@kitten I'm confused why query is executing while it's paused. Is it the designed behaviour?

@narinluangrath
Copy link
Contributor

@ifokeev Nope that is not the designated behavior. Could you reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info ✋ A question or report that needs more info to be addressable
Projects
None yet
Development

No branches or pull requests

5 participants