List widget that uses an array that sometimes could be empty

I get the following error for my List widget:
This data identifier evaluates to an empty array. Please use an identifier that evaluates to a valid value.

how can I support the List widget that feed on an array that sometimes can be empty?

Please help us with the following information for faster debugging.

Which is your current Appsmith version?
Provide screenshots/screen recordings of the original error/code snippet.
Add details about your use case and provide steps to reproduce the issue, if possible.

I use the version that runs on AppSmith cloud.


and the error

Hello! You are getting this error because the list is empty. Could you please elaborate on your use case and what you are trying to achieve here?

The items of the list originate from a query… that most times is non-empty, but sometimes can return an empty array. Seems like a very common scenario no matter what the use case is.

Ok. What impact does this error have? Does it affect the functioning of the app? Do you get any errors or issues in the deployed mode?
To get rid of this error, you can hide the list if the query’s response is empty:

Okay, I’ll try to add the visibility condition.
But as I see it, empty array should not causes an error. its a bug in appsmith.
in the same way that

[].map(p => p)
[].filter(p => p)

does not result in an error…

Yes, that is correct. We have opened this GitHub bug to get this fixed: [Bug]: This data identifier evaluates to an empty array Error When List Widget Is Empty · Issue #21767 · appsmithorg/appsmith · GitHub
Please subscribe to it to get notified about the progress.