           {:on-click #(swap! local update :position dec)}
           {:class :disabled})
         i/arrow-slide]
-       (palette-items (:colors collection) (:position @local))
+       (palette-items (:colors selected-collection) (:position @local))
        [:span.right-arrow
-        (if (< (* (+ 1 (:position @local)) 10) (count (:colors collection)))
+        (if (< (* (+ 1 (:position @local)) 10) (count (:colors selected-collection)))
           {:on-click #(swap! local update :position inc)}
           {:class :disabled})
         i/arrow-slide]

  (let [local (:rum/local own)
        collections (->> (mx/react collections-ref)
                         (vals)
                         (sort-by :name))
        collection (get-selected-collection local collections)]
    (letfn [(select-collection [event]
              (let [value (read-string (dom/event->value event))]
                (swap! local assoc :selected value :position 0)))

  [local collections]
  (if-let [selected (:selected @local)]
    (first (filter #(= selected (:id %)) collections))
    (first (filter #(and (:id %) (> (count (:colors %)) 0)) collections))))

(mx/defc palette-items
  {:mixins [mx/static]}
