Hide base if empty

What I’m trying to do

I want to hide bases that don’t have any notes. My usecase is that I embed multiple base views inside of some note to show related notes. Depending on the type of the current note some of the views can stay completely empty, so I’d like to free up that screen space.

Things I have tried

.hideBaseIfEmpty
.bases-embed:not(:has(.bases-tbody>.bases-tr)){
  display: none !important;
}

This snippet kind of works, but only when the embedded base is already opened when the snippet takes effect. When you come to this note it seems like the view is immediately hidden, so the entries are never added, so all bases stay hidden. There is an .is-loaded class, but I couldn’t get it to not break.

1 Like