Urql: userQuery with pause=true still issues an initial request

Created on 13 Jun 2019  路  8Comments  路  Source: FormidableLabs/urql

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.

needs more info

All 8 comments

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 馃憤

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?

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 :)

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

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

@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.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pix2D picture pix2D  路  4Comments

Andrew-Talley picture Andrew-Talley  路  4Comments

alexraginskiy picture alexraginskiy  路  3Comments

kitten picture kitten  路  4Comments

tgrecojs picture tgrecojs  路  4Comments