Skip to content

Error caused by missing field used as keyField in cache is shadowed #75

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

Open
jelhan opened this issue Dec 11, 2022 · 0 comments
Open

Error caused by missing field used as keyField in cache is shadowed #75

jelhan opened this issue Dec 11, 2022 · 0 comments

Comments

@jelhan
Copy link

jelhan commented Dec 11, 2022

I had an error caused by not querying a field, which was used as keyField in InMemoryCache configuration. It throw the following error:

    Invariant Violation: Missing field 'name' while extracting keyFields from {"foo": "bar","__typename":"Post"}

Debugging was very challenging because that error is shadowed. I was able to get that error by putting a breakpoint here:

this.#subscription = observable.subscribe(
(result) => {
this.#onComplete(result);
if (firstResolve) {
firstResolve();
firstResolve = undefined;
}
},
(error) => {
this.#onError(error);
if (firstReject) {
firstReject();
firstReject = undefined;
}
}
);

The error was not logged in console. QueryResource.error was undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant