Skip to content
Source
Sign inSign up
TanStack/query

TypeError: Cannot read properties of null (reading 'useEffect') #8598

Send to my agent
Closedalex-yudi(GitHub profile, opens in a new tab) opened this issue 2 comments

Describe the bug

I am working on a project using React (18.3.1) + Vite.

When deployed to production, I am encountering the error: "hook.js:608 TypeError: Cannot read properties of null (reading 'useEffect')" which is related to QueryClientProvider.

I am using TanStack Query version 5.65.1.

When I build and preview the project, it works normally, and the build does not report any errors. The issue is only occurring in production.

I have already checked a similar issue, but it neither solves nor clarifies my problem since my project is not using Next.js and does not have SSR.

Your minimal, reproducible example

can't share, is a private project

Steps to reproduce

Have a project with React + Vite

Expected behavior

The page loads, but it remains blank and shows the indicated error in the console.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OS: Linux Browser: Chrome

Tanstack Query adapter

react-query

TanStack Query version

5.65.1

TypeScript version

5.2.2

Additional context

No response

  1. Thank you for filing this issue, but we need more information before looking into this.

    Specifically, a minimal, standalone, runnable reproduction is needed - preferably with codesandbox or stackblitz. If your issue is TypeScript related, prefer a TypeScript playground.

    We'll close this issue for now, but we'll certainly re-open it if there is a proper reproduction.

  2. TkDodo closed this

  3. TkDodo added labelsneeds-info

  4. @TkDodo Even after running pnpm run dev in examples/react/nextjs, the same error occurs.

Sign in to join this conversation.