-
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
InMemoryCache
: store fields with an empty object of optional arguments the same as fields without arguments
#12370
base: release-3.13
Are you sure you want to change the base?
Conversation
…nts the same as fields without arguments
🦋 Changeset detectedLatest commit: bdf82ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
commit: |
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
size-limit report 📦
|
@@ -202,7 +202,8 @@ export abstract class EntityStore implements NormalizedCache { | |||
|
|||
public modify( | |||
dataId: string, | |||
fields: Modifier<any> | Modifiers<Record<string, any>> | |||
fields: Modifier<any> | Modifiers<Record<string, any>>, | |||
exact: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opted to add exact
only to our internal api and not expose it.
Userland code can still compare the storeFieldName
and fieldName
values passed into the modifier function to reach this goal, and we should probably not encourage people to write code like
cache.modify(id, {
fields: {
['myField({"complex":....})']() {
/* ... */
},
},
});
in the first place.
There is would be slightly more sane to use
cache.modify(id, {
fields: {
myField(value, { storeFieldName }) {
if (storeFieldName === 'myField({"complex":....})') {
/* ... */
}
},
},
});
instead.
Fixes #12365
Fixes #8853