Distinguish between no array and empty array in dependent useQueries? #3587
Unanswered
mstieranka
asked this question in
Q&A
Replies: 1 comment
-
I'm not sure why it matters that
or am I missing something? |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm currently using
useQueries
with a query dependency but there's an issue I encountered:I need to go through the result of a hook using
useQueries
and run.some()
on it to verify whether the user has a certain permission or not. However, there is no way to distinguish between the dependent data not being loaded yet and the data being an empty array.I'm also attaching the aforementioned hook (disregard
querySettings
, it contains my global error handler, among other configuration):Here you can see me create a query that just returns
undefined
as the first value if there is no data so that I can somehow find out whether the dependent data (user
) hasn't loaded yet or whetheruser.roleIds
is simply empty. However, I realize that this is a really bad hack and would like to solve it in a better way, if possible.Beta Was this translation helpful? Give feedback.
All reactions