Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some queries do not come through on client #40

Closed
ryannealmes opened this issue May 24, 2017 · 5 comments
Closed

Some queries do not come through on client #40

ryannealmes opened this issue May 24, 2017 · 5 comments
Labels
🍪 feature-request New addition or enhancement to existing solutions

Comments

@ryannealmes
Copy link
Contributor

I am trying to figure out why queries that are executed directly on the ApolloClient with .query do not appear in apollo-client-devtools. Well they do appear, but only temporarily.

When composing a graphql query on a component you get the following actions

APOLLO_QUERY_INIT
APOLLO_QUERY_RESULT

However when executing a query directly using the client (i.e. my case I am using withApollo to pass client to my component) you get the following actions

APOLLO_QUERY_INIT
APOLLO_QUERY_RESULT
APOLLO_QUERY_STOP

Queries with the latter actions seems to have their result removed from the store once retrieved. So you actually see it pop up in the devtools, but then it disappears.

Devling into the apollo-client and react-apollo it seems that composed components use

return this.queryManager.watchQuery<T>(options);

whereas withApollo uses

return this.queryManager.query<T>(options);

From my understanding query seems to remove/stop the query once it's completed. This seems to be governed by shouldSubscribe - found here. I am still not 100% sure how. The codes jumps around quite a bit. It would be great if someone could point me to some documentation or explain how ObservableQueries work in the context of the apollo-client. It seems the term subscribe is used quite a bit, but I feel like this is different from the conventional subscription people refer to in apollo. I couldn't quite link it to everything.

I am trying to get into the library so I can contribute more. Any help here would be appreciated.

In the end I would like withApollo queries to appear in the apollo-client-devtools.

Thanks.

@stubailo
Copy link
Contributor

This is because the dev tools look at currently active queries, and queries run with query(...) are only active for the short moment before the server returns. I think the best solution would be to keep some limited log of "recent queries" even when they are inactive.

@tnrich
Copy link
Contributor

tnrich commented Jun 26, 2017

@stubailo We definitely would love a way to see a list of unwatched queries. They are equally important as watched queries so there is no reason not to have them.

Thanks!

@stubailo
Copy link
Contributor

stubailo commented Jul 7, 2017

Yeah, I think that would be more of a request log or query log, whereas the watched queries thing is more about what's active on the page. I think the query and mutation request log could be one panel, and watched queries be another panel.

@tnrich
Copy link
Contributor

tnrich commented Sep 1, 2017

@stubailo I'm not sure I agree as I like the query/mutation division that currently exists. But, whatever the final solution looks like, it will be a big improvement so long as it adds the ability to review/replay unwatched queries.

Towards that end, I'm going to start hacking on a fork trying to implement this when I have some spare time.

@jcreighton jcreighton added 🍪 feature-request New addition or enhancement to existing solutions and removed 🧞‍♂️ enhancement labels Dec 8, 2020
@hwillson
Copy link
Member

Moved to #374 - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍪 feature-request New addition or enhancement to existing solutions
Projects
None yet
Development

No branches or pull requests

6 participants