lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.18k stars 32 forks source link

Issues with React Query Devtools #15

Closed JosipVuk closed 2 years ago

JosipVuk commented 2 years ago

Hey 👋 , first of all, thank you for creating this awesome lib 🙏 I have problems using it with @tanstack/react-query-devtools.

Here is an example from stack blitz, where you can reproduce the error: https://stackblitz.com/edit/nextjs-nsf8wi?file=pages/index.js

Steps to reproduce the error:

  1. Open query dev tools in the UI
  2. Click on the stringKey query -> all works fine as this query key was not created with this lib
  3. Click on the queryFactoryKey query -> whole UI breaks with throw error TypeError: 'get' on proxy: property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '[object Array]' but got '[object Array]')

For me (and probably many more devs) React Query Devtools are essential when using React Query, so this error is blocking me from using this awesome lib 😞

lukemorales commented 2 years ago

Hey @JosipVuk thank you so much for opening this issue and with a reproducible error 🙌🏻 I was not aware that this was breaking in devtools, I'll try to debug and release a fix asap

lukemorales commented 2 years ago

@JosipVuk just a heads up, that v0.6.1 has been released with the fix

JosipVuk commented 2 years ago

@lukemorales thx, I tried it out locally with the new version and I can confirm it works 🎊