Skip to content

hashQueryKey is not exported from tanstack/react-query #6186

@javier-sauma-rocketlab

Description

@javier-sauma-rocketlab

Describe the bug

I was following a video to use nextj.js 13 app router, trcp, react-query and all was good until i try to call my query from the client and sudenly all crash. I try to find a solution on google but isn't reported yet. Then I check and find that react-query have released just days before this post to 5.0.0. I did a downgrade to 4.36.1 and now all work properly.

PD: I will add more info later

Ref to video follow all steps until min 7:30

trace of the error

./node_modules/.pnpm/@trpc+react-query@10.40.0_@tanstack+react-query@5.0.0_@trpc+client@10.40.0_@trpc+server@10.40_j5b6dh2qmadaikfcthvzn2bani/node_modules/@trpc/react-query/dist/createHooksInternal-f1d4019d.mjs
Attempted import error: 'hashQueryKey' is not exported from '@tanstack/react-query' (imported as 'hashQueryKey').

Import trace for requested module:
./node_modules/.pnpm/@trpc+react-query@10.40.0_@tanstack+react-query@5.0.0_@trpc+client@10.40.0_@trpc+server@10.40_j5b6dh2qmadaikfcthvzn2bani/node_modules/@trpc/react-query/dist/createHooksInternal-f1d4019d.mjs
./node_modules/.pnpm/@trpc+react-query@10.40.0_@tanstack+react-query@5.0.0_@trpc+client@10.40.0_@trpc+server@10.40_j5b6dh2qmadaikfcthvzn2bani/node_modules/@trpc/react-query/dist/index.mjs
./src/app/_trpc/client.ts
./src/app/_trpc/Provider.tsx

package.json

  "dependencies": {
    "@tanstack/react-query": "^5.0.0",
    "@trpc/client": "^10.40.0",
    "@trpc/react-query": "^10.40.0",
    "@trpc/server": "^10.40.0",
    "next": "13.5.6",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10",
    "eslint": "^8",
    "eslint-config-next": "13.5.6",
    "postcss": "^8",
    "tailwindcss": "^3",
    "typescript": "^5"
  }
}

Your minimal, reproducible example

check the code here
https://github.com/jsaumap/next-trpc-start/tree/bug-react-query

Steps to reproduce

Expected behavior

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Tanstack Query adapter

react-query

TanStack Query version

v5.0.0

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions