From e017975162b5a60aadda1a7925183c990fc334f0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 3 Oct 2016 23:09:55 +0200 Subject: [PATCH] Store images indexed in the state. --- src/uxbox/main/data/images.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/uxbox/main/data/images.cljs b/src/uxbox/main/data/images.cljs index 539d19abc..2bf3d6c67 100644 --- a/src/uxbox/main/data/images.cljs +++ b/src/uxbox/main/data/images.cljs @@ -214,13 +214,16 @@ (defrecord ImagesFetched [coll-id items] rs/UpdateEvent (-apply-update [_ state] - (assoc-in state [:image-colls-by-id coll-id :images] (set items)))) + (reduce (fn [state {:keys [id] :as image}] + (assoc-in state [:images-by-id id] image)) + state + items))) (defn images-fetched [coll-id items] (ImagesFetched. coll-id items)) -;; --- Load Images +;; --- Fetch Images (defrecord FetchImages [coll-id] rs/WatchEvent