You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): Add possibility to pass a callback to enabled. (#7566)
* Add possibility to pass a callback to enabled.
* Refactor into using the same pattern as resolving staletime, with the use of a resolveEnabled util function
* Update tests for enabled option as a callback
* update docs
* remove typo
* Update enabled type in docs
* remove duplicated test case
* Fix eslint errors
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: John Pettersson <john.pettersson@carnegie.se>
Copy file name to clipboardexpand all lines: docs/framework/react/guides/disabling-queries.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: disabling-queries
3
3
title: Disabling/Pausing Queries
4
4
---
5
5
6
-
If you ever want to disable a query from automatically running, you can use the `enabled = false` option.
6
+
If you ever want to disable a query from automatically running, you can use the `enabled = false` option. The enabled option also accepts a callback that returns a boolean.
Enabled can also be set to a callback to support disabling queries on out of focus screens without state and re-rendering on navigation, similar to how notifyOnChangeProps works but in addition it wont trigger refetching when invalidating queries with refetchType active.
0 commit comments