New variables are not used after refetch(newVars)
See original GitHub issueHello! I don’t know how to make it better. Please help. I use the function:
async update() {
let variables = {
company: this.props.match.params.companyId,
filter: this.filter, order: this.order, limit: this.pagiation.limit, offset: this.pagiation.offset
};
await this.props.refetch(variables);
}
But I see in Network two queries and nothing happens.
The first one is right, but the second is the default data (like variables: { company: props.match.params.companyId, filter: {}, order: [], limit: 10, offset: 0 }
). Why?
@ApolloReact.graphql(ApolloReact.gql"
query Departments($company: ID!, $filter: DepartmentFilter!, $order: [DepartmentOrder], $limit: Int, $offset: Int) {
company {
get(id: $company) {
id,
name,
color,
departments {
list(filter: $filter, order: $order, limit: $limit, offset: $offset) {
departments {
id,
color,
name,
users {
id, avatar, username
},
tags {
name
},
date
},
count
}
}
}
}
}", {
props: ({ ownProps, data: { loading, company, refetch } }) => ({
company: company && company.get,
departments: company && company.get && company.get.departments && company.get.departments.list.departments,
count: company && company.get && company.get.departments && company.get.departments.list.count,
loading: loading,
refetch: refetch
}),
options: (props) => ({
fetchPolicy: 'cache-and-network',
variables: { company: props.match.params.companyId, filter: {}, order: [], limit: 10, offset: 0 }
}),
})
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:42 (7 by maintainers)
Top Results From Across the Web
Refetch not working with new variables - Help - Apollo GraphQL
Hey all, I'm using apollo-client and am experiencing a problem where I am trying to refetch some data with new variables and it...
Read more >Apollo useLazyQuery hook uses old variables when ...
I'm really stumped. It seems like the docs say new variables are supposed to be used if they are provided on refetch. I...
Read more >Chapter 5 Data Manipulation | Introduction to Stata
5.2 Generating new variables. The generate command can be used to create new variables which are functions of existing variables. For example, if...
Read more >18 Programming Stata
After all, you do not need to know how to program Stata to import data, create new variables, and fit ... 2. do...
Read more >indigo_2021.1_documentation:variable_class [Indigo Domotics]
folderId, integer, the unique id of the folder this variable is in (0 if it's not in a folder) - use moveToFolder() method...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@joebernard Thanks for reporting this. There hasn’t been any activity here in quite some time, so we’ll close this issue for now. Can you open a new issue reporting your issues with a reproduction for us to take a look into?
I have updated the versions of
apollo-client
and other packages in the reproduction and this bug is still present.Please see https://codesandbox.io/s/j3410pq2vv
@jbaxleyiii Could we revisit the original issue?