Again... GraphQL doesn't use new variables after refetching.
@graphql<Api.LoadLTorEqQuery, Api.LoadLTorEqQueryVariables, {
dataProps: DataProps
} & any>(Api.QL.Main.LoadLTorEq, {
props: ({ ownProps, data: { loading, loadLTorEq, refetch } }) => ({
data: loadLTorEq,
loadingData: loading,
refetchData: refetch
}),
options: (props) => ({
variables: {
timestamp: props.dataProps.date.getTime(),
limit: props.dataProps.limit,
symbols: props.allCoins.slice(props.pagination.offset, props.pagination.limit + props.pagination.offset),
timeframe: props.dataProps.timefame
}
}),
})
symbols are always the same.
Please HELP!
Please solve this issue!
Please, read it and fix it! It is a very very important thing!
@makamekm I agree this is huge issue with v2 here is what happens for me:
1. turn server offline
2. component loads with error { loading: false, error: 'Error: Network error: Failed to fetch', myUser: undefined }
3. turn server online and refetch
4. component loads data successfully but error is not cleared { loading: false, error: 'Error: Network error: Failed to fetch', myUser: { uuid: GJGHJ86876HUIIUH } }
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!
馃 hey stale bot! bump
that is a nasty error and i just ran in it. Is there any workaround?
I am new to graphql. I also ran into the similar issue.
For the first request the loading is true while fetching and it's working well. But while doing pagination with the second request nothing changes.
I thought I had this issue, but it turns out I was not passing variables to refetch properly.
when refetch is called, it will continue to run original query with originally-bound parameters unless new ones are supplied.
It would be helpful to add an example query _with_ variables in the docs: https://www.apollographql.com/docs/react/basics/queries.html#graphql-query-data-refetch
I am passing new variables to refetch but the refetch uses the initial variables. Interestingly if I do a fetchMore after the refetch, it will then use the new variables.
Same problem here.
I'm pretty much a rookie, so it's very possible I'm messing something up, but it seems like I'm having a similar issue. After props change, I see the new variables in props.data.variables, but the response stays the same. Only after I force a refetch I get the correct response, and that seems a bit hacky. :(
This sounds like the same problem as https://github.com/apollographql/apollo-client/issues/2499, which was resolved in https://github.com/apollographql/apollo-client/pull/3500, and released in apollo-client 2.3.2. Closing - thanks all!
Most helpful comment
I thought I had this issue, but it turns out I was not passing variables to refetch properly.
when
refetchis called, it will continue to run original query with originally-bound parameters unless new ones are supplied.It would be helpful to add an example query _with_ variables in the docs: https://www.apollographql.com/docs/react/basics/queries.html#graphql-query-data-refetch