🐛 Fix issue on importing binfile-v3 with tokens (#5714)

* 🐛 Fix issue on importing binfile-v3 with tokens

* 🐛 Fix thumbnails generation (regression)

* 🐛 Fix thumbnails clearing issues (regression)
This commit is contained in:
Andrey Antukh 2025-01-29 16:52:40 +01:00 committed by GitHub
parent c82e5f7681
commit 6fa08fc75e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -616,7 +616,7 @@
(not-empty)))
(defn- read-file-tokens-lib
[{:keys [::input ::file-id ::entries]}]
[{:keys [::bfc/input ::file-id ::entries]}]
(when-let [entry (d/seek (match-tokens-lib-entry-fn file-id) entries)]
(->> (read-plain-entry input entry)
(decode-tokens-lib)

View file

@ -761,7 +761,7 @@
(ptk/reify ::library-thumbnails-fetched
ptk/UpdateEvent
(update [_ state]
(update state :workspace-thumbnails merge thumbnails))))
(update state :thumbnails merge thumbnails))))
(defn fetch-library-thumbnails
[library-id]
@ -1408,7 +1408,7 @@
(->> (rp/cmd! :get-file-object-thumbnails {:file-id library-id :tag "component"})
(rx/map (fn [thumbnails]
(fn [state]
(update state :workspace-thumbnails merge thumbnails))))))
(update state :thumbnails merge thumbnails))))))
(rx/of (ptk/reify ::attach-library-finished)))))))
(defn unlink-file-from-library

View file

@ -65,7 +65,7 @@
[state file-id page-id frame-id tag]
(let [object-id (thc/fmt-object-id file-id page-id frame-id tag)
tp (tp/tpoint-ms)
objects (-> (dsh/lookup-file state file-id)
objects (-> (dsh/lookup-file-data state file-id)
(dsh/get-page page-id)
:objects)
shape (get objects frame-id)]
@ -94,7 +94,7 @@
ptk/UpdateEvent
(update [_ state]
(update state :workspace-thumbnails
(update state :thumbnails
(fn [thumbs]
(if-let [uri (get thumbs object-id)]
(do (vreset! pending uri)
@ -122,10 +122,10 @@
(ptk/reify ::assoc-thumbnail
ptk/UpdateEvent
(update [_ state]
(let [prev-uri (dm/get-in state [:workspace-thumbnails object-id])]
(let [prev-uri (dm/get-in state [:thumbnails object-id])]
(some->> prev-uri (vreset! prev-uri*))
(l/trc :hint "assoc thumbnail" :object-id object-id :uri uri)
(update state :workspace-thumbnails assoc object-id uri)))
(update state :thumbnails assoc object-id uri)))
ptk/EffectEvent
(effect [_ _ _]
@ -141,8 +141,8 @@
(update [_ state]
(let [old-id (dm/str old-id)
new-id (dm/str new-id)
thumbnail (dm/get-in state [:workspace-thumbnails old-id])]
(update state :workspace-thumbnails assoc new-id thumbnail)))))
thumbnail (dm/get-in state [:thumbnails old-id])]
(update state :thumbnails assoc new-id thumbnail)))))
(defn update-thumbnail
"Updates the thumbnail information for the given `id`"