can just swap directly into view-data here, no need for a cursor
i think i was originally worried that swapping into view-data directly would cause unnecessary component re-renders, but that should not ever happen because application code should not be dereferencing view-data directly (should always be using cursors).
This commit is contained in:
parent
391e8fe5af
commit
38dee6ee8e
|
@ -31,10 +31,13 @@
|
|||
(r/cursor view-data [view-sig :data]))
|
||||
|
||||
(defn- handle-view-refresh [[view-sig data]]
|
||||
(let [cursor (r/cursor view-data [view-sig])]
|
||||
(swap! cursor
|
||||
#(assoc % :loading false
|
||||
:data data))))
|
||||
(swap! view-data
|
||||
(fn [view-data]
|
||||
(if (contains? view-data view-sig)
|
||||
(update-in view-data [view-sig] assoc
|
||||
:loading false
|
||||
:data data)
|
||||
view-data))))
|
||||
|
||||
(defn subscribed?
|
||||
"Returns true if we are currently subscribed to the specified view."
|
||||
|
|
Loading…
Reference in a new issue