我的文件中有一个
useQuery
A.ts
像这样
const { data } = useQuery(MY_QUERY, {
variables: myQueryVariables
})
现在,我需要触发
MY_QUERY
的重新获取,但在另一个文件的另一个组件中,在 B.ts
中,但我需要使用与上次执行相同查询时使用的 相同的变量,但我不这样做无法访问 myQueryVariables
中的
B.ts
const { refetch } = useQuery(MY_QUERY);
// this refetches the query but without variables
refetch()
如何在不传递相同变量的情况下触发重新获取以更新缓存,从而更新 UI?