Skip to content

Unable to get latest data on refetch #423

Answered by cherniavskii
baymac asked this question in General
Discussion options

You must be logged in to vote
const id = 'some_id'
const { status, data, error, isFetching } = useStatus('status', { data_item_id: id })
pollRefresh() { // assume it keeps polling every 5 second
 queryCache.refetchQueries(['status', {data_item_id: id}])
  console.log(data);
}

I am expecting the data should be updated but it is not. It is the old data.

You're performing an async action, so you won't get new data immediately.

So your use case is to refetch query with some interval until specific response is returned, right?

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@baymac
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@cherniavskii
Comment options

@baymac
Comment options

Answer selected by baymac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants