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

Make dataId parameter of cache.modify optional. #6178

Merged
merged 2 commits into from
Apr 21, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Apr 21, 2020

Most importantly, this change allows callers of cache.modify (#5909) to avoid passing "ROOT_QUERY" as the ID for modifications of root Query data.

Making the dataId parameter optional and moving it after the modifiers parameter felt much more idiomatic and understandable than than trying to support two conflicting type signatures for the modify method, even though that extra effort could have avoided the breaking change.

Please remember that the cache.modify API was added relatively recently in @apollo/client@3.0.0-beta.34 by PR #5909, so it has never been out of beta testing, so breaking changes like this are still fair game.

Most importantly, this change allows callers of cache.modify to avoid
passing "ROOT_QUERY" as the ID for modifications of root Query data.

Making the dataId parameter optional and moving it after the modifiers
parameter felt much more idomatic and understandable than than trying to
support two conflicting type signatures for the modify method, even though
that extra effort could have avoided the breaking change.

Please remember that the cache.modify API was added in
@apollo/client@3.0.0-beta.34 by PR #5909, so it has never been out of beta
testing, so breaking changes are still fair game.
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @benjamn - LGTM!

@benjamn benjamn merged commit 6e5819b into master Apr 21, 2020
@benjamn benjamn deleted the cache.modify-ROOT_QUERY-default branch April 21, 2020 19:58
@benjamn
Copy link
Member Author

benjamn commented Apr 21, 2020

Just published these changes to npm in @apollo/client@3.0.0-beta.44.

@LinusU
Copy link

LinusU commented May 11, 2020

@benjamn just a reminder that the docs on the website still shows the old style:

https://www.apollographql.com/docs/react/v3.0-beta/data/local-state/#local-resolvers

Would be great if it could be updated 👍

@benjamn
Copy link
Member Author

benjamn commented May 26, 2020

@LinusU I'm going to be revamping the cache.modify API and its documentation (post-#6289) today / this week, so please stay tuned!

@LinusU
Copy link

LinusU commented May 26, 2020

Oh, I had missed that the API had been removed... We are using this quite heavily so looking forward to see what the revamp brings! 👏

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants