-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Cache key not updating on change #952
Comments
@sallomendo Ask a DX question. Should we need to remove the previously cached data when the key is updated? |
@wellyshen I don’t think so, we can use the clearCache function inside a useEffect hook, I think we should leave that to the dev. |
@sallomendo Sorry quite busy recently, would you mind to give me a PR for this issue? |
@sallomendo This issue has been fixed in the latest version. |
@wellyshen thanks for working on this, I will close the pr I created for this. |
@sallomendo Sorry I didn't note that, thank you! |
Bug Report
Describe the Bug
fetchPredictions
callback is not updating whencache
orcacheKey
changes.How to Reproduce
When the cache key is stateful, the window storage key doesn't change.
Expected Behavior
The cache and cache key should change when you pass a different value.
Your Environment
Additional Information
I think we need to add
cache
andcacheKey
as a dependency to theuseCallback
hook here https://github.com/wellyshen/use-places-autocomplete/blob/master/src/usePlacesAutocomplete.ts#L155The text was updated successfully, but these errors were encountered: