I’m currently working on an app that includes a task list. For this small feature I’m running into an issue that I’m looking against for a couple of days now.
I’ll try to explain what is happening:
I have a TasksCell that fetches all the tasks that are either completed or not completed depending on a prop with this query:
query TasksQuery($completed: Boolean!) {
tasks(completed: $completed) {
__typename
id
title
completedAt
}
}
In Apollo this ends up with the following two caches:
I want the system to work in such a way that when I check off an item it gets send to the other list. But without manually updating the cache the item just remains in view (But then with either a checked or unchecked status, the opposite of what it should be).
Next thing I tried was to manually delete the thing from the cache, and then when the user switches to the other list I hoped it would re-appear there. No joy with that either.
I’m not wondering is the only option that I have to “manually” delete the task from one cache list, and then add it to the other list?
Because if that is the case another issue comes up… When I add a new task, Apollo Cache decides to add it to both caches…
I really hope someone here can help me out a bit with this, because I’m out of ideas
If needed I can post more code, but since this was already a long post I didn’t want to include unneeded noise.
I’m really wondering if there would be a way to check which cache list you wanna use instead of relying on hacking the storeFieldName.
(I’m aware that this isn’t really a RedWood related issue, so feel free to close. By I have good faith in the knowledge of this community, so lets try!)
@jvanbaarsen Super sorry I missed this! I’ll get to this in the next few days with an example app; definitely looks like a tricky one but I know what you’re going for, and feels like it’s possible.