-
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
Fix watchFragment
reports complete=false
when from object is not identifiable
#12335
base: main
Are you sure you want to change the base?
Fix watchFragment
reports complete=false
when from object is not identifiable
#12335
Conversation
@ryo-manba: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
👷 Deploy request for apollo-client-docs pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: e7ed70b 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 |
❌ Docs preview failedThe preview failed to build. Build ID: 4defa33138f50499acf7d309 Errorsreact/api/react/components
|
Hey @ryo-manba 👋 Thanks for your patience! I'd actually like to dig a layer deeper and see if we can fix the issue at the root. It looks like anything having to do with a I can also reproduce the incorrect result using test.only("reports diffs incorrectly", async () => {
const cache = new InMemoryCache();
console.log(
cache.diff({
query: cache["getFragmentDoc"](gql`
fragment FooFragment on Foo {
foo
}
`),
id: cache.identify({}),
returnPartialData: true,
optimistic: true,
})
);
await new Promise((res) => {
const w = cache.watch({
query: cache["getFragmentDoc"](gql`
fragment FooFragment on Foo {
foo
}
`),
id: cache.identify({}),
returnPartialData: true,
immediate: true,
optimistic: true,
callback: (diff) => {
console.log("callback", diff);
res(void 0);
},
});
});
}); If you paste and run this, you'll notice that From what I can tell, that Let's see if we can fix it in the cache itself. Is this something you'd like to look into further? |
Thank you for the information! |
Closes #12003
Fixes an issue where
watchFragment
incorrectly reportedcomplete: true
when thefrom
object was not identifiable (cache.identify
returnedundefined
).This was created from the branch adds the failing test.
It might be better to merge that one first.