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

Allow startPolling in useLazyQuery without having to exec first #3645

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

masad-frost
Copy link

@masad-frost masad-frost commented Oct 30, 2019

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.

Related to apollographql/apollo-client#5140

This is a proof of concept / draft

When using useLazyQuery, the return value does not include ObservableQueryFields, hence you cannot call startPolling until after you call runLazyQuery which is inconvenient.

At the very least the type of the return value of useLazyQuery should be modified to indicate that ObservableQueryFields maybe undefined.

@apollo-cla
Copy link

@masad-frost: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@masad-frost masad-frost changed the title [RFC] Allow startPolling without having to exec first [RFC] Allow startPolling in useLazyQuery without having to exec first Oct 30, 2019
@masad-frost
Copy link
Author

Also wondering why lazy queries weren't just a convenience for switching skip from true to false and then forceUpdateing, wouldn't that simplify the internals?

@masad-frost masad-frost changed the title [RFC] Allow startPolling in useLazyQuery without having to exec first Allow startPolling in useLazyQuery without having to exec first Nov 5, 2019
@masad-frost
Copy link
Author

masad-frost commented Nov 8, 2019

@hwillson Looks like you were interested in looking at the problem in apollographql/apollo-client#5140

This PR explains why this is happening and adds a POC for a solution, lazy queries lose most of their value because of this issue

@masad-frost
Copy link
Author

Any body looks at PR's here? :/

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.

2 participants