Skip to content

Conversation

@jackdclark
Copy link
Contributor

@jackdclark jackdclark commented Feb 20, 2019

The issue

See #35

The following tests are failing because there should be a second request that currently isn't being sent

✕ sends the query again if the variables change, even if there was previously data (3ms)
✕ sends the query again if the variables change, even if there was previously an error (3ms)
✕ sends the query again if the query changes, even if there was previously data (2ms)
✕ sends the query again if the query changes, even if there was previously an error (2ms)

The fix

Remove the state.data & state.error check inside the useQuery effect. It already has conditional checks to make sure it only fires if query or opts.variables have changed.

✓ sends the query again if the variables change, even if there was previously data (3ms)
✓ sends the query again if the variables change, even if there was previously an error (2ms)
✓ sends the query again if the query changes, even if there was previously data (2ms)
✓ sends the query again if the query changes, even if there was previously an error (2ms)

@jackdclark jackdclark marked this pull request as ready for review February 20, 2019 11:43
Copy link
Contributor

@Joezo Joezo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried this branch out in the example app and it worked well 🎉

@jackdclark jackdclark merged commit 1e6cb49 into master Feb 20, 2019
@jackdclark jackdclark deleted the remove-use-query-conditions branch February 20, 2019 12:04
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

Successfully merging this pull request may close these issues.

2 participants