-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query): add 'getObserversCount' util #2130
feat(query): add 'getObserversCount' util #2130
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/G762B1aeJNQQaDzaNkqisaKUXx7K |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c8dd10b:
|
@TkDodo Hi, any chance this could be merged? 😉 |
sure, can you maybe use new function then in the devtools and replace the private accesses with it? |
@TkDodo Sure 👍 |
it's also used in tests with ts-expects-error as far as I can see :) |
🎉 This PR is included in version 3.14.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adding 'getObserversCount' util
Reson for making this change:
The observers on the query is private property, therefore Typescript is complaining when trying to use it.
DevTools is using the length of the observers in a couple of places like here
Since this property should probably stay as private, I have added utility to get the observers count as a getter method.