Hide a view if there are no results
Considering how many criteria might have to be considered to determine if a view can be hidden, I decided to make this a configuration option instead.

I see two ways to do this:


The component where the view is embedded can have a configuration option "Hide view if no results". This is what I went with.
One could make a symbolic views plugin for "no results behavior", named "Hide view if no results". Then one could implement e.g. hook_preprocess_views_view(), or possibly another hook, to hide the view if the new no results behavior is present.


I could write a lot more details, but for now I want to share the ideas behind these options, maybe this already helps.

I am marking this as the accepted answer. But if someone can come up with something more convincing, I will change it.