What are your strategies for determining when a query has returned zero results?

Hey there --
I've yet to settle on a good strategy for determining when a query returns zero results. Let's say I have a query called getSomeData -- Sometimes getSomeData is null when nothing comes back so I can use {{ getSomeData.data === null }} , but sometimes .data exists with all of the keys, it's just that all of the keys length are 0. So then I might try {{ getSomeData.data.id.length === 0 }} but that might not work if my first assumption is correct -- that .data is null -- in that case, you basically get an error since a reference to one of the keys is invalid (referring to a null object, hence no keys named anything). So then I get into some crazy thing that feels super hacky where I test for either condition.

My guess is that there's something much simpler that I'm missing.

Hey @LeeIsles!

If this is specifically for a SQL query that may not have run yet, you can try something like {{ _.isEmpty(getSomeData.data?.id) }}. Does that work?

The _.isEmpty function documented here is super useful for checking empty values, and throwing in some optional chaining makes it so that the transformer won't throw an error if the query hasn't run yet.

Oh yeah. I totally forgot we have lodash at our fingertips.