Skip to content

Commit

Permalink
add note about refetch variables (#300)
Browse files Browse the repository at this point in the history
add brief note to clear any variables that were set before for any query. This is helpful when you want to omit a variable from the query that was set before. e.g in case of filters you might want to clear previous filter variable but by not passing that variable will result in picking the old value.
  • Loading branch information
ehteshamkafeel authored and James Baxley committed Oct 18, 2017
1 parent 55dc5d3 commit 49ef527
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions react-docs/source/api-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Forces your component to refetch the query you defined in the `graphql()` functi

The `data.refetch` function takes a single `variables` object argument. The `variables` argument will replace `variables` used with either the `query` option or the query from your `graphql()` HOC (depending on whether or not you specified a `query`) option to refetch the query you defined in the `graphql()` function.

By default `data.refetch` or `data.fetchMore` merges the variables passed as an argument so if a variable is missed out in subsequent requests that variable will still pick the old value set before for that specific query. Old values of the nullable variables can be cleared by passing `null` or `undefined`.

**Example:**

```js
Expand Down

0 comments on commit 49ef527

Please sign in to comment.