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

partialRefetch as an option #128

Open
jfrolich opened this issue Apr 10, 2019 · 3 comments
Open

partialRefetch as an option #128

jfrolich opened this issue Apr 10, 2019 · 3 comments

Comments

@jfrolich
Copy link

The partialRefetch option is not available at the moment. Would it be possible to make it available?

More information here: https://www.apollographql.com/docs/react/essentials/queries

@jfrolich
Copy link
Author

Actually not having partial refetch enabled will cause issues if you have mutations that return less attributes than a query. The mutation will actually hang the app. I think for useQuery it's probably good to enable partialRefetch by default (it should be default for Query as well, but Apollo didn't enable the default for backwards compatibility reasons).

@brabeji
Copy link

brabeji commented Apr 26, 2019

Hello @trojanowski! This is actually very necessary functionality according to react-apollo docs:

The default value is false for backwards-compatibility's sake, but should be changed to true for most use-cases.

FWIW linking corresponding code and valuable comment:
https://github.com/apollographql/react-apollo/blob/22f8ebf52b26b348d6be905d5b7fbbfea51c1541/src/Query.tsx#L461

@layerssss
Copy link

layerssss commented Dec 15, 2019

This can be a workaround to manually implement the partialRefetch behaviour.

  // workaround for partialRefetch
  useEffect(() => {
    if (loading) return;
    if (data) return;
    if (error) return;
    // if there's no data, no error or loading, it must be stuck at `partial` state.
    refetch();
  }, [!!data, !!loading, !!error]);

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

Successfully merging a pull request may close this issue.

3 participants