From 00d995d971f9eec6a62d1c3d3de697dbb8f0fe22 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Mon, 23 Sep 2024 18:14:28 -0700 Subject: [PATCH] [ENG-3833] handle object in is bool (#3974) * handle object in is bool * use if statements --- reflex/.templates/web/utils/state.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index 66b50b1b4..78e671809 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -832,7 +832,9 @@ export const useEventLoop = ( * @returns True if the value is truthy, false otherwise. */ export const isTrue = (val) => { - return Array.isArray(val) ? val.length > 0 : !!val; + if (Array.isArray(val)) return val.length > 0; + if (val === Object(val)) return Object.keys(val).length > 0; + return Boolean(val); }; /**