-
Notifications
You must be signed in to change notification settings - Fork 72
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 is updating but computed property is not. #384
Comments
Don't forget to request id in the return value from your mutation. Without
which your cache will not update. I'm assuming that's what's happening
without seeing your mutation code because I've been bitten by this
several times.
…On Fri., Jan. 15, 2021, 4:49 p.m. SethThoburn, ***@***.***> wrote:
My view fetches the needed data, including a list of comments in the model
when it loads.
`export default class MyBusinessRoute extends Route {
@queryManager apollo;
setupController(controller, model) {
controller.set('approved_comments', model.commentSet.edges.filter(comment
=> {
return comment.node.approved == true;
}))
controller.set('unapproved_comments',
model.commentSet.edges.filter(comment => {
return comment.node.approved == false;
}))
}
async model(params) {
let variables = { id: params.business_id };
return this.apollo.watchQuery({ query, variables }, 'business')
}
}
Those comments are passed to the controller on two properties which are
***@***.*** <https://github.com/Tracked> approved_comments;
@Tracked <https://github.com/Tracked> unapproved_comments;`
In that controller, an action runs a mutation which modifies some of those
comments, and returns the modified comment. I see that the comment is
updated in the apollo cache, but the ember tracked properties do not seem
to update.
The docs don't have any examples of using a watch query in a model.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#384>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHWC3O5PDNPOZP2DMNMDD3S2CZ7PANCNFSM4WEU4N2Q>
.
|
I am fetching the ID, the cache updates but the UI does not. |
This was referenced May 28, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My view fetches the needed data, including a list of comments in the model when it loads.
Those comments are passed to the controller on two properties which are tracked:
In that controller, an action runs a mutation which modifies some of those comments, and returns the modified comment. I see that the comment is updated in the apollo cache, but the ember tracked properties do not seem to update.
The docs don't have any examples of using a watch query in a model.
The text was updated successfully, but these errors were encountered: