You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, could someone look at this to see if it's something unexpected? The use case leading to this is I have a collection field items accepting some filter args e.g items(searchTerm: String).
Somewhere on UI the query
query($searchTerm: String) {
folder {
id
items(searchTerm: $searchTerm) {
id
}
}
}
... runs with { searchTerm: null }, returing the un-filtered / whole collection.
Then a mutation
mutation {
addItem {
folder {
id
items {
id
}
}
}
}
... is expected to notify UI of added item. But since items{searchTerm:null} and items were saved as different entries in cache, UI is not notified.
Please, could someone points to me to the right direction for this. It seems that I can't get around this... apart from using two different queries ... one with args, one without args(in order to not have {} in the cache key). But that totally diminishes the point of having optional argument in GraphQL.
@louisholley sadly not. Kinda like a workaround I've changed my code to always include an argument (in my case limit: 20 for paging). Then combined with "null-arg" being set to undefined.
Intended outcome:
items { ...}
with 1 itemitems(foo: $foo) { .. }
with 2 items, with$foo
beingnull
orundefined
items { ... }
Actual outcome:
Result is 1
How to reproduce the issue:
https://codesandbox.io/s/vibrant-sun-fkcn5?file=/src/index.jsx:129-142
In the app I'm working on. I can see from Apollo devtools that these two entries are lists using different keys.
Versions
The text was updated successfully, but these errors were encountered: