Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Ensure updateQuery is included in QueryResult with useLazyQuery #3583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bwlt
Copy link

@bwlt bwlt commented Oct 11, 2019

From the documentation the result object returned by useLazyQuery should contains the updateQuery property.

Side note

In this point of code there is an unsafe casting which prevent to spot the error using the type system.
Probably other properties are missing.

Checklist:

  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • If this was a change that affects the external API used in GitHunt-React, update GitHunt-React and post a link to the PR in the discussion.

From [the documentation](https://www.apollographql.com/docs/react/api/react-hooks/#result-1) the result object returned by `useLazyQuery` should contains the `updateQuery` property.

## Side note
In this point of code there is an unsafe casting which prevent to spot the error using the type system.
Probably other properties are missing.
@bwlt
Copy link
Author

bwlt commented Oct 11, 2019

The resolution does not convince me because of this scenario:
what about if a user wants to update the query data with data even if the execution was not ran?
With this changes the updateQuery throws an invariant error.
What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant