mirror of
https://github.com/penpot/penpot.git
synced 2026-05-01 14:18:07 +00:00
🐛 Fix library update notificacions showing when they should not
This commit is contained in:
parent
6290b88d2e
commit
ed767d9a5b
@ -67,6 +67,7 @@
|
||||
- Fix nested variant in a component doesn't keep inherited overrides [Taiga #12299](https://tree.taiga.io/project/penpot/issue/12299)
|
||||
- Fix selected colors not showing colors from children shapes in multiple selection [Taiga #12384](https://tree.taiga.io/project/penpot/issue/12385)
|
||||
- Fix scrollbar issue in design tab [Taiga #12367](https://tree.taiga.io/project/penpot/issue/12367)
|
||||
- Fix library update notificacions showing when they should not [Taiga #12397](https://tree.taiga.io/project/penpot/issue/12397)
|
||||
|
||||
## 2.10.1
|
||||
|
||||
|
||||
@ -139,9 +139,9 @@
|
||||
(fn [data]
|
||||
(assoc file :data (d/removem (comp t/pointer? val) data))))))
|
||||
|
||||
(defn- check-libraries-synchronozation
|
||||
(defn- check-libraries-synchronization
|
||||
[file-id libraries]
|
||||
(ptk/reify ::check-libraries-synchronozation
|
||||
(ptk/reify ::check-libraries-synchronization
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [file (dsh/lookup-file state file-id)
|
||||
@ -154,7 +154,7 @@
|
||||
libraries)]
|
||||
|
||||
(when needs-check?
|
||||
(->> (rx/of (dwl/notify-sync-file file-id))
|
||||
(->> (rx/of (dwl/notify-sync-file))
|
||||
(rx/delay 1000)))))))
|
||||
|
||||
(defn- library-resolved
|
||||
@ -168,30 +168,32 @@
|
||||
[file-id features]
|
||||
(ptk/reify ::fetch-libries
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(rx/concat
|
||||
(->> (rp/cmd! :get-file-libraries {:file-id file-id})
|
||||
(rx/mapcat
|
||||
(fn [libraries]
|
||||
(rx/concat
|
||||
(rx/of (dwl/libraries-fetched file-id libraries))
|
||||
(rx/merge
|
||||
(->> (rx/from libraries)
|
||||
(rx/merge-map
|
||||
(fn [{:keys [id synced-at]}]
|
||||
(->> (rp/cmd! :get-file {:id id :features features})
|
||||
(rx/map #(assoc % :synced-at synced-at :library-of file-id)))))
|
||||
(rx/mapcat resolve-file)
|
||||
(rx/map library-resolved))
|
||||
(->> (rx/from libraries)
|
||||
(rx/map :id)
|
||||
(rx/mapcat (fn [file-id]
|
||||
(rp/cmd! :get-file-object-thumbnails {:file-id file-id :tag "component"})))
|
||||
(rx/map dwl/library-thumbnails-fetched)))
|
||||
(rx/of (check-libraries-synchronozation file-id libraries))))))
|
||||
(watch [_ _ stream]
|
||||
(let [stopper-s (rx/filter (ptk/type? ::finalize-workspace) stream)]
|
||||
(->> (rx/concat
|
||||
(->> (rp/cmd! :get-file-libraries {:file-id file-id})
|
||||
(rx/mapcat
|
||||
(fn [libraries]
|
||||
(rx/concat
|
||||
(rx/of (dwl/libraries-fetched file-id libraries))
|
||||
(rx/merge
|
||||
(->> (rx/from libraries)
|
||||
(rx/merge-map
|
||||
(fn [{:keys [id synced-at]}]
|
||||
(->> (rp/cmd! :get-file {:id id :features features})
|
||||
(rx/map #(assoc % :synced-at synced-at :library-of file-id)))))
|
||||
(rx/mapcat resolve-file)
|
||||
(rx/map library-resolved))
|
||||
(->> (rx/from libraries)
|
||||
(rx/map :id)
|
||||
(rx/mapcat (fn [file-id]
|
||||
(rp/cmd! :get-file-object-thumbnails {:file-id file-id :tag "component"})))
|
||||
(rx/map dwl/library-thumbnails-fetched)))
|
||||
(rx/of (check-libraries-synchronization file-id libraries))))))
|
||||
|
||||
;; This events marks that all the libraries have been resolved
|
||||
(rx/of (ptk/data-event ::all-libraries-resolved))))))
|
||||
;; This events marks that all the libraries have been resolved
|
||||
(rx/of (ptk/data-event ::all-libraries-resolved)))
|
||||
(rx/take-until stopper-s))))))
|
||||
|
||||
(defn- workspace-initialized
|
||||
[file-id]
|
||||
|
||||
@ -1193,19 +1193,22 @@
|
||||
(ctf/used-assets-changed-since file-data library sync-date))))))
|
||||
|
||||
(defn notify-sync-file
|
||||
;; file-id is the id of the modified library
|
||||
[file-id]
|
||||
(dm/assert! (uuid? file-id))
|
||||
"Notify the user that there are updates in the libraries used by the
|
||||
current file, and ask if he wants to update them now."
|
||||
[]
|
||||
(ptk/reify ::notify-sync-file
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [file (dsh/lookup-file state (:current-file-id state))
|
||||
(let [file-id (:current-file-id state)
|
||||
file (dsh/lookup-file state file-id)
|
||||
file-data (get file :data)
|
||||
ignore-until (get file :ignore-sync-until)
|
||||
|
||||
libraries-need-sync
|
||||
(filter #(seq (assets-need-sync % file-data ignore-until))
|
||||
(vals (get state :files)))
|
||||
(->> (vals (get state :files))
|
||||
(filter #(= (:library-of %) file-id))
|
||||
(filter #(seq (assets-need-sync % file-data ignore-until))))
|
||||
|
||||
do-more-info
|
||||
#(modal/show! :libraries-dialog {:starting-tab "updates" :file-id file-id})
|
||||
|
||||
|
||||
@ -331,4 +331,4 @@
|
||||
(watch [_ state _]
|
||||
(when (contains? (:files state) file-id)
|
||||
(rx/of (dwl/ext-library-changed file-id modified-at revn changes)
|
||||
(dwl/notify-sync-file file-id))))))
|
||||
(dwl/notify-sync-file))))))
|
||||
|
||||
@ -84,6 +84,9 @@
|
||||
(l/derived :shared-files st/state))
|
||||
|
||||
(defn select-libraries
|
||||
"Find between all the given files, those who are libraries of the file-id.
|
||||
Also include the file-id file itself.
|
||||
Return a map of id -> library."
|
||||
[files file-id]
|
||||
(persistent!
|
||||
(reduce-kv (fn [result id file]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user