Download for Firefox | Download for Chrome
This repository contains the Apollo Client Browser Devtools extension for Chrome & Firefox.
The Apollo Client Browser Devtools appear as an "Apollo" tab in your web browser inspector, alongside other tabs like "Elements" and "Console". The devtools currently have four main features:
You can install the extension via Firefox Browser Add-ons or the Chrome Webstore. If you want to install a local version of the extension instead, skip ahead to the Developing section.
While your application is in dev mode, the devtools will appear as an "Apollo" tab in your web browser inspector. To enable the devtools for your application in production, pass connectToDevTools: true
to the ApolloClient constructor in your application. Pass connectToDevTools: false
if want to manually disable this functionality.
The "Apollo" tab will appear in your web browser inspector if a global window.__APOLLO_CLIENT__
object exists in your application. Apollo Client adds this hook to the window automatically unless process.env.NODE_ENV === 'production'
. If you would like to use the devtools in production, manually attach your Apollo Client instance to window.__APOLLO_CLIENT__
or pass connectToDevTools: true
to the constructor.
If you are seeing the "Apollo" tab but are still having issues, skip ahead to the Debugging section.
After cloning this repo, install the required packages:
cd apollo-client-devtools
npm install
We provide a sample application to run when developing and testing the extension. To run it, install the required dependencies for both the client and server:
npm run install:dev
Then start the application:
npm run start:dev
Navigate to localhost:3000
to view the application. To view the API schema, navigate to localhost:4000
.
For cross-browser development, we rely on the web-ext command line tool and a modified version of the WebExtWebpackPlugin that hooks into the build process.
To develop with Firefox, run the following command:
npm run firefox
For Chrome, run the following command:
npm run chrome
Running either of these commands will:
webpack --watch
to watch source files for changeslocalhost:3000
(the sample application)Note that even though the extension is rebuilt and reloaded, a hard refresh is still required. Hot reloading is not an option for web extensions.
Defaults can be found and modified in the WebExtPlugin. You might want to do so if you'd like the targeted browser to open to a different address or to turn on lintOnBuild
.
We use Jest and the React Testing Library to write and run our tests.
To run tests for both src
and development
, run the following command:
npm run test
You can also run with --watch
to watch and re-run tests automatically:
npm run test:watch
There are two main pieces of the Apollo Client Browser Devtools: the extension itself and a React application. The extension is the code that communicates with the browser. It allows us to search an inspected window for an instance of Apollo Client and to create the Apollo tab in the browser's devtools panel. The React application powers the experience in the devtools panel.
The devtools folder structure mirrors this architecture. The source code for the extension can be found in src/extension
. The React application code can be found in src/application
.
For builds, we use the build
folder. After a build, all of the files needed to run the devtools can be found here. If these files are bundled for development, source maps are provided. When these files are bundled for production, source maps are not provided and the code is minified. We use the dist
folder for distributable zip files.
If there is an error in the devtools panel, you can inspect it just like you would inspect a normal webpage. Detach the inspector console from the window (if it's not already detached) by clicking the button with three vertical dots in the upper right corner of the console and selecting the detach option. With the detached console in focus, press opt-cmd-I
again to open an inspector for the detached console (inspector inception). In this new inspector you will be able to inspect elements in the first inspector, including the devtools panel.
If you are using Apollo Client 2.0, make sure you are using at least version 2.0.5 of the devtools.
If you are using Apollo Client 3.0, make sure you are using at least version 2.3.5 of the devtools.
If you're seeing an error that's being caused by the devtools, please open an issue on this repository with a detailed explanation of the problem and steps that we can take to replicate the error.
Release process, for those with permission:
./package.json
and ./src/extension/manifest.json
version numbers.npm run zip
to pack all of the builds for submission.npm publish
in the root of the project. We're publishing to npm to allow other projects to have a dependency on devtools.chrome://extensions/
Load unpacked
.apollo-client-devtools/build
directory.Apollo Client Devtools
extension to update.Package
then Upload new package
../dist/chrome.zip
file for upload.about:debugging#/runtime/this-firefox
Load Temporary Add-on
.apollo-client-devtools/dist/apollo_client_developer_tools-X.X.X.zip
file.apollo-client-devtools/dist/apollo_client_developer_tools-X.X.X.zip
for upload and submit.This project is governed by the Apollo Code of Conduct.
Apollo builds open-source software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with:
Check out the Odyssey learning platform, the perfect place to start your GraphQL journey with videos and interactive code challenges. Join the Apollo Community to interact with and get technical help from the GraphQL community.
使用Apollo 优势是什么: 声明式数据获取:编写gql查询并接收数据,而无需手动跟踪加载状态 出色的开发人员经验:享受TypeScript,Chrome DevTools和VS Code的有用工具 专为现代React设计:充分利用最新的React功能,例如hooks 可逐步采用:将 Apollo无缝插入任何JavaScript应用程序,可以直接嵌套到任何一个前端项目中 如何获取数据: 可以在
Apollo Client 是一个全功能的 GraphQL 客户端,用于 React 、Angular 的交互。允许你轻松通过 GraphQL 获取数据并构建 UI 组件。
ember-apollo-client Use @apollo/client and GraphQL from your Ember app. This addon is battle tested: it has been used to build several large apps. As such, we've solved real-world problems such as rel
apollo-upload-client A terminating Apollo Link for Apollo Client that fetches a GraphQL multipart request if the GraphQL variables contain files (by default FileList, File, Blob, or ReactNativeFile in
我是Apollo/GraphQL的新手,我正试图在一个新建项目中正确地完成身份验证。我的身份验证提供程序是AWS。我编写了一个cognito helper模块来与它交互。 虽然我不太确定如何同步我的apollo客户端与我的auth状态。 现在,我只是通过在react组件处理程序中调用这些函数来处理我的登录。我配置了一个apollo-link,用于添加auth头。将我的JWT令牌数据注入到后端的上下
我在测试Apollo时遇到了问题。当我尝试使用apollo和graph ql进行查询时,我想要响应返回错误和部分数据,所以我设置了属性errorPolicy:“all”。但它不起作用。我不知道为什么?请帮助!这是我的代码: 查询{动物{姓名年龄},学校{姓名数字}}` const{加载,数据,错误}=使用查询(GET\u DASHBOARD\u data,{错误策略:'all',未完成:(res)
我在尝试运行我的 React Native Expo 应用程序时安装 Apollo 后遇到错误。我尝试过删除节点模块并重新安装,重置缓存,重新启动计算机,但仍然没有运气。 Android 捆绑失败 456 毫秒 尝试从文件解析模块 < Li >/mnt/c/Users/14044/Desktop/Coding/divi/client/node _ modules/@ Apollo/client/m