mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
🐛 Fix problem with thumbnail generation when changing between versions
This commit is contained in:
parent
3eab9da74e
commit
bcdf5d86ae
4 changed files with 29 additions and 7 deletions
|
@ -1,5 +1,11 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 2.4.1
|
||||||
|
|
||||||
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fix problem with thumbnail generation when changing between versions [Taiga #9624](https://tree.taiga.io/project/penpot/issue/9624)
|
||||||
|
|
||||||
## 2.4.0
|
## 2.4.0
|
||||||
|
|
||||||
### :rocket: Epics and highlights
|
### :rocket: Epics and highlights
|
||||||
|
|
|
@ -52,6 +52,11 @@
|
||||||
(defonce queue
|
(defonce queue
|
||||||
(q/create find-request (/ 1000 30)))
|
(q/create find-request (/ 1000 30)))
|
||||||
|
|
||||||
|
(defn clear-queue!
|
||||||
|
[]
|
||||||
|
(l/dbg :hint "clearing thumbnail queue")
|
||||||
|
(q/clear! queue))
|
||||||
|
|
||||||
;; This function first renders the HTML calling `render/render-frame` that
|
;; This function first renders the HTML calling `render/render-frame` that
|
||||||
;; returns HTML as a string, then we send that data to the iframe rasterizer
|
;; returns HTML as a string, then we send that data to the iframe rasterizer
|
||||||
;; that returns the image as a Blob. Finally we create a URI for that blob.
|
;; that returns the image as a Blob. Finally we create a URI for that blob.
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
[app.main.data.events :as ev]
|
[app.main.data.events :as ev]
|
||||||
[app.main.data.persistence :as dwp]
|
[app.main.data.persistence :as dwp]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
|
[app.main.data.workspace.thumbnails :as th]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
|
@ -132,6 +133,7 @@
|
||||||
(rx/filter #(or (nil? %) (= :saved %)))
|
(rx/filter #(or (nil? %) (= :saved %)))
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/mapcat #(rp/cmd! :restore-file-snapshot {:file-id file-id :id id}))
|
(rx/mapcat #(rp/cmd! :restore-file-snapshot {:file-id file-id :id id}))
|
||||||
|
(rx/tap #(th/clear-queue!))
|
||||||
(rx/map #(dw/initialize-file project-id file-id)))
|
(rx/map #(dw/initialize-file project-id file-id)))
|
||||||
(case origin
|
(case origin
|
||||||
:version
|
:version
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
|
[app.util.object :as obj]
|
||||||
[app.util.time :as t]
|
[app.util.time :as t]
|
||||||
[beicon.v2.core :as rx]))
|
[beicon.v2.core :as rx]))
|
||||||
|
|
||||||
|
@ -47,13 +48,14 @@
|
||||||
|
|
||||||
;; NOTE: Right now there are no cases where we need to cancel a process
|
;; NOTE: Right now there are no cases where we need to cancel a process
|
||||||
;; but if we do, we can use this function
|
;; but if we do, we can use this function
|
||||||
;; (defn- cancel-process
|
(defn- cancel-process!
|
||||||
;; [queue]
|
[queue]
|
||||||
;; (l/dbg :hint "queue::cancel-process")
|
(l/dbg :hint "queue::cancel-process")
|
||||||
;; (let [timeout (unchecked-get queue "timeout")]
|
(let [timeout (unchecked-get queue "timeout")]
|
||||||
;; (when (some? timeout)
|
(when (some? timeout)
|
||||||
;; (js/clearTimeout timeout))
|
(js/clearTimeout timeout))
|
||||||
;; (unchecked-set queue "timeout" nil)))
|
(unchecked-set queue "timeout" nil))
|
||||||
|
queue)
|
||||||
|
|
||||||
(defn- process
|
(defn- process
|
||||||
[queue iterations]
|
[queue iterations]
|
||||||
|
@ -131,3 +133,10 @@
|
||||||
(enqueue-last queue request))))
|
(enqueue-last queue request))))
|
||||||
|
|
||||||
(rx/to-observable result)))
|
(rx/to-observable result)))
|
||||||
|
|
||||||
|
(defn clear!
|
||||||
|
[queue]
|
||||||
|
(-> queue
|
||||||
|
(cancel-process!)
|
||||||
|
(obj/set! "items" #js [])
|
||||||
|
(obj/set! "time" 0)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue