Eden TanStack Query

Troubleshooting

Solutions for common issues with Eden TanStack Query

Troubleshooting

Installation

Peer Dependencies

Ensure all required packages are installed:

bun add eden-tanstack-react-query @tanstack/react-query @elysiajs/eden elysia

Version Compatibility

PackageMinimum Version
@tanstack/react-query5.102.8, within v5
@elysiajs/eden1.3.0
elysia1.3.0
typescript5.5.2

React Query versions below 5.102.8 are outside the supported peer range. See Upgrading from an earlier release for the dependency migration.


Provider Errors

"useEden must be used within an EdenProvider"

The useEden hook is called outside the provider tree.

// Wrong — useEden is outside provider
function App() {
  const eden = useEden() // Error!
  return (
    <EdenProvider client={edenClient}>
      <YourApp />
    </EdenProvider>
  )
}

// Correct — useEden inside provider
function App() {
  return (
    <EdenProvider client={edenClient}>
      <YourApp /> {/* useEden works here */}
    </EdenProvider>
  )
}

"No QueryClient set"

Ensure QueryClientProvider wraps EdenProvider:

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <EdenProvider client={edenClient}>
        <YourApp />
      </EdenProvider>
    </QueryClientProvider>
  )
}

Cache Issues

Cache Not Updating After Mutation

Mutations don't automatically refresh queries. Use invalidateQueries in onSuccess:

const createUser = useMutation({
  ...eden.users.post.mutationOptions(),
  onSuccess: () => {
    queryClient.invalidateQueries(eden.users.get.queryFilter())
  }
})

Wrong Data in Cache for Path Params

If different path params return the same data, verify query keys differ:

console.log(eden.users({ id: '1' }).get.queryKey())
// [['users', 'get'], {
//   pathParams: [{ pathIndex: 0, entries: [['id', '1']] }],
//   type: 'query'
// }]

console.log(eden.users({ id: '2' }).get.queryKey())
// [['users', 'get'], {
//   pathParams: [{ pathIndex: 0, entries: [['id', '2']] }],
//   type: 'query'
// }]

If keys are identical, update to the latest version of eden-tanstack-react-query.


Type Errors

"Property does not exist on type"

The proxy mirrors your Elysia routes. If a property doesn't exist:

  1. Verify the route exists on your Elysia app
  2. Ensure you export the type: export type App = typeof app (not just export { app })
  3. Restart TS server: Cmd/Ctrl + Shift + P > "TypeScript: Restart TS Server"

Generic Inference Shows unknown

Don't reassign the Elysia app variable — it loses type inference:

// Bad — loses types
let app = new Elysia()
app = app.get('/users', () => [...])

// Good — chain methods preserves types
const app = new Elysia()
  .get('/users', () => [...])

Also ensure you use import type:

import type { App } from '../server'

Numeric Path Parameters

Path params accept both strings and numbers (string | number). Values are serialized into the URL, and the library normalizes them when building the query key, so both forms address the same cache entry:

// Both compile and hit the same cache entry
eden.users({ id: 123 }).get.queryOptions()
eden.users({ id: '123' }).get.queryOptions()

Query Parameters Not Typed

Add a query schema to your Elysia route for types to flow through:

app.get('/users', ({ query }) => {
  // ...
}, {
  query: t.Object({
    search: t.Optional(t.String()),
    limit: t.Optional(t.Number())
  })
})

Monorepo Issues

Types Not Syncing Across Packages

Export the app type from your server package:

packages/server/src/index.ts
export type { App } from './app'
packages/client/src/eden.ts
import type { App } from '@myorg/server'

Use TypeScript project references if needed:

packages/client/tsconfig.json
{
  "references": [{ "path": "../server" }]
}

Getting Help

If your issue isn't covered here:

  1. Search GitHub Issues — your problem might already be reported
  2. Open an issue with package versions, minimal reproduction, and error messages
  3. Use React Query DevTools for debugging cache issues

On this page