#No QueryClient set

8 messages · Page 1 of 1 (latest)

distant hill
#

How to fix: Error "No QueryClient set, use QueryClientProvider to set one" in NextJS starter please?

fallen kernel
#

npm install medusa-react@latest

royal apex
distant hill
#

And my files are already using @tanstack/react-query instead of react-query. This is why I don't understand what's wrong

fallen kernel
#

Have you removed the workaround from next.config, as @royal apex said?

distant hill
#

@fallen kernel I didn't use the workaround, i just cloned a fresh install and it already has this "workaround" bundled

distant hill
#

Ok I fixed it by commenting the workaround. my next.config.js looks like this now :

const { withStoreConfig } = require("./store-config")
const store = require("./store.config.json")
const path = require("path")

module.exports = withStoreConfig({
  features: store.features,
  reactStrictMode: true,
  images: {
    domains: ["medusa-public-images.s3.eu-west-1.amazonaws.com", "localhost"],
  },
  // webpack: (config, options) => {
  //   if (options.isServer) {
  //     config.externals = ["@tanstack/react-query", ...config.externals]
  //   }
  //   const reactQuery = path.resolve(require.resolve("@tanstack/react-query"))
  //   config.resolve.alias["@tanstack/react-query"] = reactQuery
  //   return config
  // },
})

console.log("next.config.js", JSON.stringify(module.exports, null, 2))