Issue Description
Description
When using @defer directive with Apollo Client, the cache becomes inconsistent after deleting an item and refetching. While the server returns the correct data after deletion and refetch, the UI renders duplicate entries of the remaining items.
Example query demonstrating @defer usage:
query Books {
books {
id
title
... @defer {
deferredInfo {
id
title
}
}
}
}
Expected Behavior
(Refers to screenshots in Reproduction steps)
After deletion and refetch, UI should display only the remaining items matching the server response.
Actual Behavior
UI displays duplicate entries of remaining items, despite server returning correct data.
Additional Context
- Issue occurs specifically when using
@defer directive
- Standard queries without deferred fields work correctly
- Manual cache updates via
cache.modify() resolve the issue
Link to Reproduction
https://github.com/timofarei/apollo-gql-incremental-delivery-refetch-bug
Reproduction Steps
- Clone repository: [link to repo]
- Run the app and note the list of two books:
- Delete the first book using the delete button
- Observe that the remaining book appears twice in the list
@apollo/client version
3.12.4
Issue Description
Description
When using
@deferdirective with Apollo Client, the cache becomes inconsistent after deleting an item and refetching. While the server returns the correct data after deletion and refetch, the UI renders duplicate entries of the remaining items.Example query demonstrating
@deferusage:Expected Behavior
(Refers to screenshots in Reproduction steps)
After deletion and refetch, UI should display only the remaining items matching the server response.
Actual Behavior
UI displays duplicate entries of remaining items, despite server returning correct data.
Additional Context
@deferdirectivecache.modify()resolve the issueLink to Reproduction
https://github.com/timofarei/apollo-gql-incremental-delivery-refetch-bug
Reproduction Steps
@apollo/clientversion3.12.4