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

Add warning message when a component can't render #2721

Closed
gaetansnl opened this issue Dec 13, 2017 · 1 comment
Closed

Add warning message when a component can't render #2721

gaetansnl opened this issue Dec 13, 2017 · 1 comment

Comments

@gaetansnl
Copy link

If I have this query on MyComponent

objectA(id:$id){
 id,
 subobject{
    id,
    somefield
 }
}

And if I do a mutation and my mutation result look like this

objectA{
 id,
 subobject{
    id
 }
}

If the subobject id is updated during the mutation, MyComponent can't render because I don't fetch somefield.

Intended outcome:
Something to tell me why the component doesn't render anymore

Actual outcome:
The exception is ingnored in QueryManager.prototype.getCurrentQueryResult

 try {
                var data = this.dataStore.getCache().read({
                    query: query,
                    variables: variables,
                    previousResult: lastResult ? lastResult.data : undefined,
                    optimistic: true,
                });
                return apolloUtilities.maybeDeepFreeze({ data: data, partial: false });
            }
            catch (e) {
                return apolloUtilities.maybeDeepFreeze({ data: {}, partial: true });
            }

Version

  • apollo-client@<2.0.3

PS: I agree this error should not happen if I don't forget my fields, but sometimes it happens.

@hwillson hwillson self-assigned this Jun 14, 2018
@hwillson hwillson removed their assignment Aug 5, 2018
@settings settings bot removed the refetch label Dec 12, 2018
@hwillson
Copy link
Member

This has been addressed by #4743, and will be coming in Apollo Client 2.6. You can set returnPartialData to true to have previous partial cache results used, instead of having the returned data set to an empty object.

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants