Rozenite GraphQL Client DevTool
rozenite-graphql-client-devtool is an early-stage debugging plugin designed for React Native applications utilizing GraphQL clients, specifically within the Rozenite developer tools platform. Currently at version 0.0.7, this package provides a comprehensive interface for monitoring GraphQL operations, inspecting the client's cache, and exploring the GraphQL schema in real-time. It supports Apollo Client out-of-the-box, with future plans to include URQL and Relay. The project appears to be in active development, releasing updates as features mature rather than on a fixed cadence. Its key differentiators include its integration with the Rozenite ecosystem, strong focus on React Native debugging, and a flexible adapter pattern to support various GraphQL clients, offering granular control over what data (variables, responses) is tracked.
Warnings
- gotcha When combining Apollo Links, the `apolloGraphqlDevtoolLink` must be placed first in the `ApolloLink.from` array to ensure it captures all GraphQL operations, including mutations and subscriptions.
- gotcha This package is currently in early development (version 0.0.7). While functional, the API may undergo changes in future minor or patch releases until a stable 1.0.0 version is reached.
Install
-
npm install rozenite-graphql-client-devtool -
yarn add rozenite-graphql-client-devtool -
pnpm add rozenite-graphql-client-devtool
Imports
- apolloGraphqlDevtoolLink
const { apolloGraphqlDevtoolLink } = require('rozenite-graphql-client-devtool');import { apolloGraphqlDevtoolLink } from 'rozenite-graphql-client-devtool'; - useGraphqlClientDevtool
import useGraphqlClientDevtool from 'rozenite-graphql-client-devtool';
import { useGraphqlClientDevtool } from 'rozenite-graphql-client-devtool'; - GraphQLClientAdapter
import { GraphQLClientAdapter } from 'rozenite-graphql-client-devtool';import type { GraphQLClientAdapter } from 'rozenite-graphql-client-devtool';
Quickstart
import { ApolloClient, InMemoryCache, ApolloLink, HttpLink, ApolloProvider } from '@apollo/client';
import { apolloGraphqlDevtoolLink, useGraphqlClientDevtool } from 'rozenite-graphql-client-devtool';
import React from 'react';
import { View, Text } from 'react-native';
// 1. Create the DevToolLink Link
const devToolLink = apolloGraphqlDevtoolLink();
// 2. Create your HTTP Link
const httpLink = new HttpLink({
uri: 'https://api.example.com/graphql',
});
// 3. Combine links - Rozenite Link MUST be first
const client = new ApolloClient({
link: ApolloLink.from([
devToolLink, // ⚠️ IMPORTANT: Must be first to capture all operations
httpLink,
]),
cache: new InMemoryCache(),
});
function MyGraphQLComponent() {
return (
<View>
<Text>Your GraphQL-powered content here.</Text>
</View>
);
}
function App() {
// 4. Initialize the devtool
useGraphqlClientDevtool({
client,
clientType: 'apollo',
includeVariables: true,
includeResponseData: true,
});
return (
<ApolloProvider client={client}>
<MyGraphQLComponent />
</ApolloProvider>
);
}