Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to add isCached to onSucces #82

Closed
lishine opened this issue Dec 17, 2019 · 1 comment
Closed

Request to add isCached to onSucces #82

lishine opened this issue Dec 17, 2019 · 1 comment

Comments

@lishine
Copy link

lishine commented Dec 17, 2019

Hi,
I would like to have isCached info in the onSuccess. The use case is using AsyncTypeahead and to ease the processing of new data - if I know that it comes from cache I would know that I have this data already locally and would not need to compare for uniqiness like bellow:

const { isLoading } = useQuery(['selectPublisher', { query }], fetchPublishers, {
		onSuccess: data => {
			publishersResults = _uniqBy([...publishersResults, ...data], ({ id }) => id)
		},
	})

I find onSuccess is very usefull for postprocessing. Maybe it is usefull to add also other useQuery return values to onSucess params.

@lishine
Copy link
Author

lishine commented Dec 17, 2019

It seems that onSuccess not called when data coming from cache. So closing.

@lishine lishine closed this as completed Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant