Returning data from a Supabase function & evaluating an element

Hi friends, I’m loving the Supabase plugin. (Thank you, WeWeb team.)

Here’s my workflow to validate a property returned from a Supabase custom function.

In this case, if the user is not onboarded, I will redirect them to the appropriate page.

Question: Is using JavaScript in the WeWeb workflow the best way to determine the truthiness of an object or parameter?

return context.workflow['a15586d6-d6c4-4733-8bae-95736e642b7e']?.result || false;

There will be cases where I want to know if an array has any values so I can do something like this:

return context.workflow['ae4d4a35-10f9-44c1-97a9-3daa2b43d7ec']?.result?.length > 0 || false;

Thank you!

You should be able to do the same with the formula, this seems simple enough. You also can use the nullish coalescent ?? operator.

Thank you. I’m over-thinking and trying to solve problems that aren’t real.

I now understand that I need to log in and trigger each test in my workflow rather than trying to be defensive with an undefined dependent step.

Moving on!