-
Notifications
You must be signed in to change notification settings - Fork 167
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
Apollo dev tools 4.0 not showing any data with multiple Apollo Clients #822
Comments
I'm having the same issue with The "Explorer" tab works fine, and executing any queries there will populate the Queries/Cache tabs. However, executing queries in my app does nothing, so does not seem to be listening. |
Actually, it's working for me now. I find that |
Sadly does not work for me.... |
Had the same issue, but noticed that the code was creating multiple apollo clients - if this happens, only the first client is attached to the window as In short - make sure you only create a single apollo client, or if you do create multiple, make sure to assign the one you want to inspect via dev-tools to the window manually. |
This was the missing piece! It looks like you can only watch one Apollo client at a time. Thanks @henrinormak ! |
Just sharing this related stack overflow post that seems to be relating to this issue. https://stackoverflow.com/a/72116931/1880490 |
Have found that "GraphQL Network Inspector" Chrome extension is working nicely |
...actually, I might misunderstood its purpose... |
...and regarding multiple instances of Apollo Client, the client attached to window of my app has "2" in the name: "ApolloClient2"...
|
Hi there, How is useData used? How many places is it used? But before you rewrite anything, could you please help us isolate where the problem might be by going to another site that uses apollo and see whether you see data there? e.g. https://studio.apollographql.com/login should show some queries If you do see data there then we'll know that it's something to do with which instance of apollo client the extension is talking to |
Same problem here, did not work locally, but worked on https://studio.apollographql.com/login. Restarting Chrome helped. |
Had a similar issue while doing local development. The extension didn't work properly when I was accessing my app via |
Hey, how do you check if there are indeed multiple instances of Apollo Client being created? And how do you assign the one you want to be able to inspect in Apollo Devtools? |
I have the same issue even with just one client. I removed all named clients. It's very frustrating not have not working dev tools. Sometime I also have some ghost data from ancient times. So it looks like sometime it works and then breaks and displays old data. It also like the extension doesn't work correctly if apollo client is created "to late". So if you have an SPA and do no create Apollo on initial load it will not show up at all. |
@MrDoomBringer This bug has been outstanding for some time, given your recent exploration into the duplicate queries issue we recently resolved, I was curious if you want to take a look that this one as well. 🙏 cc @bignimbus |
I found the issue in my case. Because of React re-rendering the code, it was executing (and generating) multiple |
@MrDoomBringer @bignimbus This might be an interesting issue to pick up soon for investigation. What do you think? |
@MrDoomBringer let me help you here: |
Recently ran into this issue due to late creation of our apollo client instance. There are also multiple instances across different teams which made utilizing dev tools almost impossible. I was able to fix it by cloning the extension, increasing the timeout it waits for the client to be instantiated and binded dev tools to a unique global variable here in the code
Seems like a more user friendly option would be to provide some configurability and let users bind to a custom variable or to manually execute the binding. |
Hey @johnhok 👋 We are considering a different approach to registering clients with the dev tools at some point. Unfortunately the way the Apollo Client and dev tools communicates is through a single No guarantees on timeline, but I can at least say we are thinking about it! I think it would be super helpful to be able to toggle between the two clients and inspect what each is doing independently. If your fork is working for you now, I'd suggest using that for the time being. I'd prefer not to do much to the current |
hi @johnhok did you end up forking the extension, build it locally then load it as unpacked chrome extension? |
Yep that's exactly what I did. I forked it and did the hacky modifications I mentioned about increasing the timeout and binding to a different global variable. Only the specific apollo client I was interested in gets assigned to that variable. Once you build it with the instructions in the readme you can load it as an unpacked extension like you mentioned. |
@johnhok thank you I plan to do so :), based on the code, it does not seems a "different" global variable is needed though. can just suppress unwanted ones with explicit |
Was happening because next.js renders our app (ui/_app.tsx) twice, and the cache is initialized during that process. This seems to be because of next.js rewrites, and is normal behavior: vercel/next.js#33028 (comment) However, the Apollo dev tools extension doesn't work properly (shows nothing) when multiple apollo clients are created. See: apollographql/apollo-client-devtools#822 (comment)
Was happening because next.js renders our app (ui/_app.tsx) twice, and the cache is initialized during that process. This seems to be because of next.js rewrites, and is normal behavior: vercel/next.js#33028 (comment) However, the Apollo dev tools extension doesn't work properly (shows nothing) when multiple apollo clients are created. See: apollographql/apollo-client-devtools#822 (comment)
Was happening because next.js renders our app (ui/_app.tsx) twice, and the cache is initialized during that process. This seems to be because of next.js rewrites, and is normal behavior: vercel/next.js#33028 (comment) However, the Apollo dev tools extension doesn't work properly (shows nothing) when multiple apollo clients are created. See: apollographql/apollo-client-devtools#822 (comment)
Same issue here. Only one Apollo Client Devtools does not show any data using It does work when using the GraphQL Network Inspector extension, but that does not allow for cache inspection. Any news on this? |
Hey @diogocapela we've done a lot of work recently on the message passing between the client and devtools. Would you give a more recent version of the devtools a shot to see if it has resolved your issue finding the client? If not, feel free to open a new issue and I'd be happy to assist looking further into this :) |
For me it does not work in 4.9.0 |
@adrianwix @diogocapela which version of Apollo Client are you using? Sorry to hear you're blocked on using the extension - as @jerelmiller said, we'd love to get some more info and debug further. Since only one instance of the client is being created, please feel free to open a new issue. And if you're able to create a reproduction in an app we can run locally, that would be tremendously helpful 🙏 |
"@apollo/client": "^3.8.7" @alessbell. |
@adrianwix do you mind creating a separate issue for this? I'd like to track this separately and keep the discussion in that issue so we don't clutter up this one too much 🙂. I'd love to help in any way I can. I think there might be an edge case we aren't handling yet. |
i dont have duplicate instances and i am also getting the same, connectToDevTools: true chrome : Version 124.0.6367.119 (Official Build) (64-bit) |
is this issue addressed? somehow it seems magically working now |
@kjhuang-db we've done a lot of work to shore up the message passing so I think its more stable than it used to be. Glad to hear its working better now! What is currently missing is the ability to switch between which client's data you're looking at in the devtools. Right now it only shows you the last one that connected to the devtools. I've got a WIP PR that will be addressing this bit so that if it detects multiple clients, you'll be able to switch between them. I'm hoping to finish this up within the next week or two. |
Hey all 👋 Thanks so much for the patience on this issue! There has been a lot of activity here and judging by the comments has caused quite a few headaches in the past. I've got #1418 ready to go that will fully enable this capability and allow you to connect and inspect multiple client instances in the devtools. This change will also take advantage of an upcoming feature in Apollo Client 3.11 that will allow you to name your client for easier debugging in the devtools. Our plan is to try and release this change alongside 3.11 which should land some time next week (barring any last minute issues we find in that release). I'm really hoping this will benefit apps that use multiple clients. I'm very excited to get this out there! Thanks again for your patience!! |
Any updates on the client's v3.11 release? Currently facing issues with the messaging where the queries, mutations, and cache values are empty. This is with:
In a production build, I noticed that our app's initial queries were caught by the devtools, before clearing out from the tool after a second or two, without a trace. |
@leosoaivan we're looking to get 3.11 out by latest tomorrow morning so expect it soon. We'll be pushing #1418 along with this to take advantage of the new devtools option in 3.11. The reason you're likely not seeing data is because any client instantiated after the first one will "override" the client the devtools is looking at. If the 2nd instance of the client has no queries, you won't see data available. I'm definitely looking forward to getting #1418 out to fix this issue 🙂 |
@jerelmiller Appreciate the update. I was just about to say that I was fairly certain we weren't initializing additional clients after double-checking, but I just found another one in an area owned by another team after triple-checking 😩. Thanks again 😆. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
Apollo Client 3.11 has now been released alongside #1418 providing the capability to connect and inspect multiple client instances. If you find any issues with the new feature, please open a new issue and I'd be happy to take a look. Thanks! |
Intended outcome:
I expect to be able to see the queries data in browser extension.
Actual outcome:
Not showing any data.
How to reproduce the issue:
Install extension in browser.
Desktop (please complete the following information):
The dev tools version is 4, same situation in Chrome as in Firefox. "@apollo/client": "^3.5.7",
The application is React + Vitejs, if it makes any difference... No idea where to start any debuging, please help...
The text was updated successfully, but these errors were encountered: