Consider the following useLazyLoadQuery:
const data = useLazyLoadQuery(
graphql`
query TodoQuery($id: ID!, $visible: Boolean!) {
todo(id: $id) @include(if: $visible) {
id
}
}
`,
{
id: "",
visible: false,
},
{
fetchPolicy: "store-and-network",
}
);
When using fetchPolicy store-or-network no request is made due to the fact that the resulting selection is empty.
When we instead try to use store-and-network an empty unnecessary query is made to the server.