Open zsid opened 4 years ago
I would pass the skip option into the second query like this:
const { loading, error, data: user } = useQuery(GET_USER);
const { loading: loadingProfile, data: userProfile } = useQuery(GET_USER_PROFILE, {
variables: { id: user && user.id },
skip: user == null
});
This tells the second query to not request anything until the user data is available.
Intended outcome: I would like to be able to execute multiple queries that depend on one another. For example:
Actual outcome: It throws an error since user is
undefined
How to reproduce the issue: