-
Notifications
You must be signed in to change notification settings - Fork 6
Clear Cache #14
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
Comments
I also recently had this issue and thought I would leave my solution. This seems to be more related to Apollo. Adding What I concluded is the way Apollo caches data, it automatically uses cached data and bypasses a request if a document with the same I'm assuming this is your problem as well and not the typo |
I am having the same issues, and even as I am using fetchPolicy: "network-only" or I even tried fetchPolicy: "no-cache". I can't get the query to re-run even though an edit mutation has been done on the same document. Template.patientInfo.created = function() {
this.member = new ReactiveVar(false);
Session.set("showLoadingPatientForm", false);
tempInst = this;
this.autorun(function() {
if (Session.get("showLoadingPatientForm")) console.log("reload");
if (FlowRouter.getParam("id")) {
let variables = { _id: FlowRouter.getParam("id") };
let currentPatient = Template.instance()
.gqlQuery({
query: GET_PATIENT,
fetchPolicy: "no-cache",
variables: variables
})
.get();
if (currentPatient && currentPatient.patient) {
tempInst.member.set(currentPatient.patient);
Session.set("showLoadingPatientForm", false);
}
} else {
tempInst.member.set({});
}
});
}; I am checking in the DB and the object has chanegd but the GET_PATIENT query is not run because I have logs there. |
I think the issue is that Blaze Apollo does it's own (kind-of) caching to prevent unneeded reruns in autoruns (like template helpers). Lines 32 to 41 in dc4015c
If the request doesn't change (like when it has I don't know yet how to fix this. If we don't use the Blaze caching then you can't directly use the queries in helpers, but need to define them in the onCreated and pass it to a ReactiveVar which you'll use in your helpers, for example. That's a lot less fluent, but safer. Any other suggestions are welcome. Side note: As you might have noticed, Blaze-Apollo isn't actively maintained/developed, because we're moving to React ourselves. Blaze is great, but has a lot of quirks. We have more trust in React for future development and projects. If we can fix things with reasonable investment, we will, but Blaze-Apollo will stay mostly "as is". Thanks. |
@boboci9, re-reading your issue it seems that nothing will trigger your autorun so no attempt will be made to do a refetch. If a mutation was done somewhere, make sure you update the Apollo cache correctly. That should trigger the underlying watchQuery. Changing the FlowRouter id param starts a new query, right? |
I am trying to run a new query on the client and for the life of me I can not get not bypass the cached results
This is the code that I am running and changing the variables that are being used seems to have no effect on the result that is returned
Any help would be greatly appreciated currently I am at the banging my head on a wall stage...
The text was updated successfully, but these errors were encountered: