Exclude empty collections from query

Is it possible to exclude empty collections from my query when using the Storefront API? I’m trying to construct a menu and I don’t want to present collections with no products.

I don’t believe there is a way to do it with the API alone. Would filtering the query result on the client before constructing the menu work? (eg. if products.edges is an empty array you know it’s an empty collection)