
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
@apollo/client-integration-tanstack-start
Advanced tools
This package provides integrations between Apollo Client and TanStack Start to support modern streaming SSR.
This package provides integrations between Apollo Client and TanStack Start to support modern streaming SSR.
Install dependencies:
npm i @apollo/client-integration-tanstack-start @apollo/client graphql
In your routes/__root.tsx, change from createRootRoute to createRootRouteWithContext to provide the right context type to your application.
+import type { ApolloClientIntegration } from "@apollo/client-integration-tanstack-start";
import {
- createRootRoute
+ createRootRouteWithContext
} from "@tanstack/react-router";
-export const Route = createRootRoute({
+export const Route = createRootRouteWithContext<ApolloClientIntegration.RouterContext>()({
In your router.tsx, set up your Apollo Client instance and run routerWithApolloClient
import {
routerWithApolloClient,
ApolloClient,
InMemoryCache,
} from "@apollo/client-integration-tanstack-start";
import { HttpLink } from "@apollo/client";
import { createRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";
export function getRouter() {
const apolloClient = new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({ uri: "https://your.graphql.api" }),
});
const router = createTanStackRouter({
routeTree,
context: {
...routerWithApolloClient.defaultContext,
},
});
return routerWithApolloClient(router, apolloClient);
}
[!IMPORTANT]
ApolloClientandInMemoryCacheneed to be imported from@apollo/client-integration-tanstack-start, not from@apollo/client.
loader with preloadQuery and useReadQueryimport { useReadQuery } from "@apollo/client";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/loader-defer")({
component: RouteComponent,
loader: ({ context: { preloadQuery } }) => {
const queryRef = preloadQuery(QUERY, {
variables: { myVariable: "myValue" },
});
return {
queryRef,
};
},
});
function RouteComponent() {
const { queryRef } = Route.useLoaderData();
const { data } = useReadQuery(queryRef);
return (
<div> do something with `data` here </div>
)
}
useSuspenseQueryYou can also use the suspenseful Apollo Client api useSuspenseQuery (or useQueryRef and useReadQuery) directly into your component without a loader:
import { useSuspenseQuery } from "@apollo/client";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/myPage")({
component: RouteComponent,
});
function RouteComponent() {
const { data } = useSuspenseQuery(QUERY);
return <div> do something with `data` here </div>;
}
FAQs
This package provides integrations between Apollo Client and TanStack Start to support modern streaming SSR.
The npm package @apollo/client-integration-tanstack-start receives a total of 322 weekly downloads. As such, @apollo/client-integration-tanstack-start popularity was classified as not popular.
We found that @apollo/client-integration-tanstack-start demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.