npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@octanejs/apollo-client

v0.1.29

Published

Apollo Client bindings for the octane renderer — reuses Apollo's framework-neutral core and ports its React adapter onto octane.

Downloads

3,262

Readme

@octanejs/apollo-client

Apollo Client 4 bindings for Octane. The package reuses Apollo's client, cache, links, GraphQL types, and testing core unchanged, while porting the published React hook adapter to Octane's compiler-slotted hooks.

The adapter is pinned and surface-tested against @apollo/[email protected].

Install

pnpm add @octanejs/apollo-client @apollo/client graphql rxjs

Use

Apollo 4 keeps its framework-neutral API at the package root and its component adapter on /react. The Octane package mirrors that split:

import {
	ApolloClient,
	InMemoryCache,
	HttpLink,
	gql,
	type TypedDocumentNode,
} from '@octanejs/apollo-client';
import { ApolloProvider, useQuery } from '@octanejs/apollo-client/react';
interface ViewerData {
	viewer: {
		id: string;
		name: string;
	};
}

const client = new ApolloClient({
	cache: new InMemoryCache(),
	link: new HttpLink({ uri: '/graphql' }),
});

const GET_VIEWER: TypedDocumentNode<ViewerData> = gql`
	query Viewer {
		viewer {
			id
			name
		}
	}
`;

function Viewer() @{
	const result = useQuery(GET_VIEWER);

	@if (result.loading) {
		<p>Loading…</p>
	} @else if (result.error) {
		<p>{result.error.message}</p>
	} @else {
		<p>{(result.data?.viewer.name ?? 'Unknown viewer') as string}</p>
	}
}

export function App() @{
	<ApolloProvider client={client}>
		<Viewer />
	</ApolloProvider>
}

The complete Apollo 4.2.6 client hook surface is available, including lazy queries, mutations, subscriptions, fragments, Suspense queries, background and loadable queries, query references, skipToken, and query preloading.

For tests, import Apollo's framework-neutral mocks from @octanejs/apollo-client/testing and the Octane MockedProvider from @octanejs/apollo-client/testing/react.

Server rendering

Apollo's useQuery does not suspend, so a single server-rendering pass cannot wait for network data. Use the Apollo-aware prepass to retain subscriptions, finish nested queries, and return Octane's final HTML and scoped CSS:

import { createElement } from 'octane';
import { renderToString } from 'octane/server';
import { prerenderStatic } from '@octanejs/apollo-client/react/ssr';

const rendered = await prerenderStatic({
	tree: createElement(App, { client }),
	renderFunction: renderToString,
});

const { html, css } = rendered.renderFnResult;
const apolloState = client.extract();

Create a separate Apollo client for every server request. Restore apolloState into the browser client's InMemoryCache before calling hydrateRoot so cached queries adopt the server markup without duplicate network requests. Queries using ssr: false or fetchPolicy: 'no-cache' remain client-only, matching Apollo 4.2.6. Streaming cache patches are not provided.

Compatibility

  • Hooks and public TypeScript overloads track Apollo Client 4.2.6.
  • Suspense unwraps Apollo's stable query promises through Octane use() rather than throwing promises.
  • Omitted React dependency arrays that intentionally mean “every render” are explicit null in the port so Octane does not infer a narrower dependency set.
  • React Server Components and Apollo's React Compiler output are out of scope.
  • MockedProvider accepts normal Octane children blocks; use a descriptor-style children={<App />} prop when childProps must be cloned onto the child.
  • Apollo-aware buffered SSR is available from /react/ssr; streaming cache patches remain out of scope.

The adapter sources are derived from Apollo Client at commit f934b60720fc828a61e04b00988eeefb83d273bc, under Apollo's MIT license. Local changes are limited to Octane imports, hook semantics, Suspense site identity, the render-phase guard, and the functional MockedProvider.