electron-trpc icon indicating copy to clipboard operation
electron-trpc copied to clipboard

hashQueryKey is not exported from `tanstack/react-query`

Open 8spw opened this issue 11 months ago • 1 comments

I was setting up @tanstack/react-query in electron app, but on v5 it shows error

hashQueryKey is not exported from tanstack/react-query

this error appears because in v5 hashQueryKey was renamed to hashKey

This is my App.tsx demo, same as you have in examples, I downgraded @tanstack/react-query on 4.36.1 and works fine

import { RouterProps, RouterProvider } from '@tanstack/react-router'
import { createTRPCReact } from '@trpc/react-query'
import { useState } from 'react'
import type { AppRouter } from '../../main/api/index'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ipcLink } from 'electron-trpc/renderer'

type AppProps = { router: RouterProps['router'] }
const api = createTRPCReact<AppRouter>()

const App = ({ router }: AppProps) => {
  const [queryClient] = useState(() => new QueryClient())
  const [trpcClient] = useState(() =>
    api.createClient({
      links: [ipcLink()]
    })
  )

  return (
    <api.Provider client={trpcClient} queryClient={queryClient}>
      <QueryClientProvider client={queryClient}>
        <div className="mt-6">
          <div className="title-bar-area" />
          <RouterProvider router={router} />
        </div>
      </QueryClientProvider>
    </api.Provider>
  )
}

export default App

8spw avatar Dec 19 '24 23:12 8spw

Experiencing the same issue

jakeisnt avatar Feb 18 '25 20:02 jakeisnt