Best way to invalidate entities in graphcache from "outside"? #2283
-
I have a type of data on the server that is updated through a different API (has to go through a different service). At the moment I'm running the query from the client directly after I know I updated the data: import { useClient } from 'urql';
...
const client = useClient();
...
await someRestApi.updateThingOnTheServer();
client
.query(ThingDataDocument, undefined, { requestPolicy: 'network-only' })
.toPromise(); // have to call .toPromise to trigger the query, the stream is lazy I think I've also had success with Is there a better way to do this? I'm happy to get a "no" answer or a frame challenge, I just want to make sure I didn't miss anything obvious. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Currently we have no solution for that, we have been thinking about it in #2076 but still think it could introduce a lot of footguns. As you mention a manual refetch or subscription is a good solution, however some kind off control-flow exchange that allows you to simulate a mutation response would probably be a good thing to implement as well. |
Beta Was this translation helpful? Give feedback.
Currently we have no solution for that, we have been thinking about it in #2076 but still think it could introduce a lot of footguns.
As you mention a manual refetch or subscription is a good solution, however some kind off control-flow exchange that allows you to simulate a mutation response would probably be a good thing to implement as well.