cgrand / enlivez

8 stars 0 forks source link

Collapsing empty sections #36

Open cgrand opened 5 years ago

cgrand commented 5 years ago

Imagine you have a header followed by a list and that you don't want to display the whole section where there's no entry in the list.

(ez/for {:db/id list :list/name name :list/entries _}
  [:div 
    [:h1 name]
    [:ul
      (ez/for {:db/id list :list/entries {:item/title title}}
        [:li title])]])

is the best one can actually do. In the absence of rules the query must be duplicated (and this can be a maintenance woe if some filtering is going on).

How could this be avoided syntactically?