apollographql / apollographql/apollo-client-integrations

TypeError in TanStack Start integration: Cannot read properties of undefined (reading 'has') in useStaticValueRef

Open
#490 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
556
Forks
53
PR merge metrics
No merged PRs in 30d

Description

### Bug Description
When using @apollo/client-integration-tanstack-start with server-side rendering, the application crashes with a TypeError in the useStaticValueRef function. The error occurs during renderToPipeableStream and prevents the page from rendering.

### Error Message
```
Error in renderToPipeableStream: TypeError: Cannot read properties of undefined (reading 'has')
at Object.useStaticValueRef (/project/sandbox/node_modules/.pnpm/@apollo+client-integration-tanstack-start@0.12.3-alpha.5_@apollo+client@3.13.8_@tanstack+reac_vwztb3tbdgqrge5w64pzauledq/node_modules/@apollo/client-integration-tanstack-start/src/ApolloProvider.tsx:82:7)
at useTransportValue (/project/sandbox/node_modules/.pnpm/@apollo+client-react-streaming@0.12.3-alpha.5_@apollo+client@3.13.8_@types+react@19.1.8_graph_nbc2pd5h74exbuz2gad3urpa6u/node_modules/@apollo/client-react-streaming/src/DataTransportAbstraction/backpressuredCallback.ts:23:34)
at (/project/sandbox/node_modules/.pnpm/@apollo+client-react-streaming@0.12.3-alpha.5_@apollo+client@3.13.8_@types+react@19.1.8_graph_nbc2pd5h74exbuz2gad3urpa6u/node_modules/@apollo/client-react-streaming/src/transportedQueryRef.ts:236:5)
at useSuspenseQuery (/project/sandbox/node_modules/.pnpm/@apollo+client@3.13.8_@types+react@19.1.8_graphql@16.11.0_react-dom@19.1.0_react@19.1.0/node_modules/@apollo/src/react/hooks/useSuspenseQuery.ts:180:4)
at Home (/project/sandbox/src/routes/index.tsx:23:20)
at react-stack-bottom-frame (/project/sandbox/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-server.node.development.js:9176:18)
at renderWithHooks (/project/sandbox/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-server.node.development.js:4797:19)
at renderElement (/project/sandbox/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-server.node.development.js:5232:23)
at retryNode (/project/sandbox/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-server.node.development.js:5991:31)
at performWork (/project/sandbox/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-server.node.development.js:6835:17) { componentStack: [Getter] }
```

### Environment
- **Package version:** @apollo/client-integration-tanstack-start@0.12.3-alpha.5
- **Apollo Client version:** @apollo/client@3.13.8
- **React version:** 19.1.0
- **TanStack Start:** 1.129.8

### Reproduction
A minimal reproduction case is available at: https://codesandbox.io/p/devbox/frosty-firefly-vjd7jy

### Steps to Reproduce
1. Set up a TanStack Start project with Apollo Client integration
2. Use useSuspenseQuery in a component during SSR
3. The error occurs during server-side rendering

### Expected Behavior
The page should render successfully on the server without throwing a TypeError.

### Actual Behavior
The application crashes with a TypeError when trying to access the has property of an undefined object in useStaticValueRef.

This appears to be a regression or compatibility issue with the current alpha version of the TanStack Start integration.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the linked CodeSandbox reproduction and trace the SSR failure from src/routes/index.tsx:23 through renderToPipeableStream to ApolloProvider.tsx:82 and useStaticValueRef. Confirm that useSuspenseQuery during server rendering no longer throws and that the page renders successfully on the server.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
full-stack
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.