mirror of
https://github.com/penpot/penpot.git
synced 2025-07-23 03:57:22 +02:00
🐛 Fix problems with cache and thumbnails
This commit is contained in:
parent
6c2d2e142b
commit
7dbe39b1b5
4 changed files with 39 additions and 21 deletions
|
@ -29,15 +29,20 @@
|
|||
|
||||
:else
|
||||
(let [subject (rx/subject)]
|
||||
(swap! pending assoc key subject)
|
||||
(->> observable
|
||||
(rx/catch #(do (rx/error! subject %)
|
||||
(swap! pending dissoc key)
|
||||
(rx/throw %)))
|
||||
(rx/tap
|
||||
(fn [data]
|
||||
(let [entry {:created-at (dt/now) :data data}]
|
||||
(swap! cache assoc key entry))
|
||||
(rx/push! subject data)
|
||||
(rx/end! subject)
|
||||
(swap! pending dissoc key))))))))
|
||||
(do
|
||||
(swap! pending assoc key subject)
|
||||
|
||||
(rx/subscribe
|
||||
observable
|
||||
|
||||
(fn [data]
|
||||
(let [entry {:created-at (dt/now) :data data}]
|
||||
(swap! cache assoc key entry))
|
||||
(swap! pending dissoc key)
|
||||
(rx/push! subject data)
|
||||
(rx/end! subject))
|
||||
|
||||
#(do
|
||||
(swap! pending dissoc key)
|
||||
(rx/error! subject %))))
|
||||
subject))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue