Skip to content

Newly added use client directives don't work as expected in RSCΒ #4876

@ChristianIvicevic

Description

@ChristianIvicevic

Describe the bug

In #4738 the use client directive was added to client-side files but trying to use the React Query Devtools is throwing errors attached below:

error - ./node_modules/@tanstack/react-query-devtools/build/lib/Explorer.mjs
Attempted import error: 'useState' is not exported from 'react' (imported as 'React').

Import trace for requested module:
./node_modules/@tanstack/react-query-devtools/build/lib/Explorer.mjs
./node_modules/@tanstack/react-query-devtools/build/lib/devtools.mjs
./node_modules/@tanstack/react-query-devtools/build/lib/index.mjs
./src/app/layout.tsx

image

Your minimal, reproducible example

https://github.com/ChristianIvicevic/tanstack-query-rsc-use-client-issue

Steps to reproduce

  1. npm install
  2. npm run dev
  3. Open the application

Expected behavior

No server error with the devtools being available.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Not relevant.

TanStack Query version

4.23.0

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions