Skip cache using useResource hook
thomas174 opened this issue · 1 comments
thomas174 commented
Without using the react hooks you can do something like that to skip the cache:
const state = await resource.refresh();
But is it possible to skip the cache using the useResource hook? The example below returns the movie object from the cache.
const client = useClient();
const resource = client.follow("movie", {id: id});
const {loading, error, resourceState, setResourceState} = useResource(resource);
evert commented
Interesting idea. Usually I would recommend to people to try and figure out why they need it (can you invalidate the cache in another way? why does it need to be refreshed?)
However, I think there's valid reasons to want this. For instance, if you expect that the server may have had a state change (perhaps by another user).
So, makes sense to me a s a feature request; and this is something that should probably be extended to other hooks like useCollection