-
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
Fuzzy type policies don't support type-level merge
functions
#11480
Comments
Oh, I just noticed #6901 mentions |
Hi @amannn 👋🏻 thanks for opening this issue! This area of the library is not something the current team has dealt with a lot so give us some time to get some recommendations together for you. @benjamn did recently write this very helpful spec though, which might help move things forward for you: apollo-client/src/cache/inmemory/__tests__/policies.ts Lines 664 to 687 in a604ac3
|
Oh right, thank you so much! I can confirm that this fixes my reproduction: new InMemoryCache({
typePolicies: {
Page: {
keyFields: false,
merge: true,
},
},
possibleTypes: {
Page: ["^.*Page$"],
},
}), Working example with |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
I tried out fuzzy type policies in an app of mine and noticed that type-level
merge
functions don't work correctly. That means, at least an error is printed, the result looks ok (however it also does when I don't specify any type policies).Link to Reproduction
https://codesandbox.io/p/devbox/apollo-client-cache-merge-svk8yx?file=%2Fsrc%2Findex.jsx%3A7%2C1
Reproduction Steps
See the cache configuration in
index.jsx
: Depending on if fuzzy type matching is used or not, themerge
function will be applied.Related: #10639
The text was updated successfully, but these errors were encountered: