-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is dataIdFromObject being deprecated? #9799
Comments
@bohdanbirdie This is a great question, so let me confirm with the team what the plan is to fully deprecate that API so we can give you clear direction on your migration to V3. cc @hwillson @benjamn |
Thanks, @jpvajda |
👋 @bohdanbirdie - the short answer is that we aren't deprecating The long answer is that we think type policies are a safer way to customize cache keys, as outlined in the last few bullet points of our Customizing identifier generation globally docs. The common
This being said, there are situations where |
@hwillson thanks for the clear answer! |
I'm going to close this and link to #9817 |
In the Apollo client v3 the
dataIdFromObject
is marked as deprecated, but still available for the backward compatibility.In our GraphQL server, every entity could have one of the specific ID keys, eg
id
,guid
,_id
,whateverKey
, etc.Previously we were using
dataIdFromObject
with the logic to select one of the known types of keys from the entity.Example:
So the cache keys would be
User:dasd-ed2-d
andComment:123
.At the moment we are migrating to the V3, but since the function is marked as deprecated, eventually, we will have to replace it with the
keyFields
. And adding thekeyFields
literally to every type is error-prone and time-consuming.So, my question - is there actually plans to remove it, and what could be the easy replacement for it in my use case?
The text was updated successfully, but these errors were encountered: