apollographql / apollo-feature-requests

🧑‍🚀 Apollo Client Feature Requests | (no 🐛 please).
Other
130 stars 7 forks source link

Able to detect wether entity in cache is optimistic or not #389

Open piotrpawlik opened 1 year ago

piotrpawlik commented 1 year ago

Problem

There is a constant problem with optimistic responses when trying to delete optimistic resource before actual response comes back.

When artificially created id is added to optimistic response (which is common practise), then deleting such object will fail, since id is unknown to backend.

Suggested solution

I'd like to see sometime similar to solutions to this floating on the Internet (such as this) to be officially incorporated into apollo-client.

This would save effort to manually add linked solution to every optimistic response and unify approach to this problem.