Open jfrolich opened 5 years ago
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).
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
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]);
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