-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
Description
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