enabled
truthy values
#4748
Unanswered
timothedelion
asked this question in
General
Replies: 1 comment
-
we've had this in v2 and moved away from this in v3. We now:
query/packages/query-core/src/queryObserver.ts Lines 176 to 181 in af2e27e I'm not really sure why we don't allow non-booleans. I think being explicit about your intentions doesn't hurt though :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
enabled
is considered falsy only if it is strictly equal tofalse
.So if you pass
undefined
or""
toenabled
, it will be considered truthy and the query will be triggered. Which is not what I expect intuitively.What do you think about casting the input value as a
Boolean
? Am I missing a part of the picture ?Beta Was this translation helpful? Give feedback.
All reactions