         (mf/use-callback (mf/deps file) #(st/emit! (dw/unlink-file-from-library (:id file) %)))
 
         contents-str
-        (fn [library graphics-count colors-count]
-          ;; Include a &nbsp; so this block has always some content
-          (str
-           (str/join " · "
-                     (cond-> []
-                       (< 0 graphics-count)
-                       (conj (tr "workspace.libraries.graphics" graphics-count))
+        (fn [library]
+          (let [graphics-count (count (get-in library [:data :media] []))
+                colors-count (count (get-in library [:data :colors] []))]
+            ;; Include a &nbsp; so this block has always some content
+            (str
+             (str/join " · "
+                       (cond-> []
+                         (< 0 graphics-count)
+                         (conj (tr "workspace.libraries.graphics" graphics-count))
 
-                       (< 0 colors-count)
-                       (conj (tr "workspace.libraries.colors" colors-count))))
-           "\u00A0"))]
+                         (< 0 colors-count)
+                         (conj (tr "workspace.libraries.colors" colors-count))))
+             "\u00A0")))]
     [:*
      [:div.section
       [:div.section-title (tr "workspace.libraries.in-this-file")]
       [:div.section-list
        [:div.section-list-item
         [:div.item-name (tr "workspace.libraries.file-library")]
-        [:div.item-contents (contents-str file
-                                          (count (:media-objects file))
-                                          (count (:colors file)))]]
+        [:div.item-contents (contents-str file)]]
        (for [library sorted-libraries]
          [:div.section-list-item {:key (:id library)}
           [:div.item-name (:name library)]
-          [:div.item-contents (contents-str library
-                                            (count (:media-objects library))
-                                            (count (:colors library)))]
+          [:div.item-contents (contents-str library)]
           [:input.item-button {:type "button"
                                :value (tr "workspace.libraries.remove")
                                :on-click #(unlink-library (:id library))}]])

  (:require
   [rumext.alpha :as mf]
   [cuerdas.core :as str]
   [app.util.dom :as dom]
   [app.util.i18n :as i18n :refer [t tr]]
   [app.util.data :refer [classnames matches-search]]

         (for [file filtered-files]
           [:div.section-list-item {:key (:id file)}
            [:div.item-name (:name file)]
            [:div.item-contents (contents-str file)]
            [:input.item-button {:type "button"
                                 :value (tr "workspace.libraries.add")
                                 :on-click #(link-library (:id file))}]])]
