Skip to content
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

Remove deprecated language from dataIdFromObject #9817

Closed
jpvajda opened this issue Jun 13, 2022 · 2 comments · Fixed by #9825
Closed

Remove deprecated language from dataIdFromObject #9817

jpvajda opened this issue Jun 13, 2022 · 2 comments · Fixed by #9825

Comments

@jpvajda
Copy link
Contributor

jpvajda commented Jun 13, 2022

Related Issues

#9799
apollographql/apollo-feature-requests#363

Issue

In our documentation for dataIDFromObject We specify this function will be deprecated soon we haven't decide on when to officially remove this functionality which has lead to some questions from our community.

History

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 dataIdFromObject approach is:

  • Sensitive to aliasing mistakes
    
  • Usually fails to protect against undefined object properties
    
  • Makes it easy to accidentally use different key fields at different times leading to cache inconsistencies
    

Therefore it has marked as deprecated for a while.

Decision

We have decided to not deprecate this functionality as:

dataIdFromObject still provides an essential service of identifying objects whose type policies don't have keyFields configured, as a sort of catch-all or backstop for the cache identification system.

dataIdFromObject plays a role in how we implement our default support for id-based identification: defaultDataIdFromObject.

So we want to update our documentation accordingly.

@jpvajda jpvajda changed the title Actually deprecated dataIdFromObject from AC v3 Actually deprecate dataIdFromObject from AC v3 Jun 13, 2022
@benjamn
Copy link
Member

benjamn commented Jun 13, 2022

@jpvajda That may all be true, but dataIdFromObject still provides an essential service of identifying objects whose type policies don't have keyFields configured, as a sort of catch-all or backstop for the cache identification system.

In fact, dataIdFromObject plays a role in how we implement our default support for id-based identification: defaultDataIdFromObject.

In other words, I think this issue gets it backwards: we need to remove language about the "deprecation" of dataIdFromObject from our documentation, and not continue with the deprecation at all.

@jpvajda jpvajda changed the title Actually deprecate dataIdFromObject from AC v3 Remove deprecated language from dataIdFromObject Jun 13, 2022
@jpvajda jpvajda self-assigned this Jun 13, 2022
@jpvajda
Copy link
Contributor Author

jpvajda commented Jun 13, 2022

@benjamn thanks for clarifying! I can update the docs accordingly.

@jpvajda jpvajda linked a pull request Jun 14, 2022 that will close this issue
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants