0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 11:38:24 -05:00

🐛 Fix on shared libraries updates popup with several libraries, the update button remains disabled after updating one

This commit is contained in:
Pablo Alba 2023-10-31 13:18:27 +01:00
parent 08c69e751d
commit e01b2e9a5f
3 changed files with 18 additions and 5 deletions

View file

@ -842,6 +842,15 @@
(def valid-asset-types (def valid-asset-types
#{:colors :components :typographies}) #{:colors :components :typographies})
(defn set-updating-library
[updating?]
(ptk/reify ::set-updating-library
ptk/UpdateEvent
(update [_ state]
(if updating?
(assoc state :updating-library true)
(dissoc state :updating-library)))))
(defn sync-file (defn sync-file
"Synchronize the given file from the given library. Walk through all "Synchronize the given file from the given library. Walk through all
shapes in all pages in the file that use some color, typography or shapes in all pages in the file that use some color, typography or
@ -912,7 +921,8 @@
(:redo-changes changes) (:redo-changes changes)
file)) file))
(rx/concat (rx/concat
(rx/of (msg/hide-tag :sync-dialog)) (rx/of (set-updating-library false)
(msg/hide-tag :sync-dialog))
(when (seq (:redo-changes changes)) (when (seq (:redo-changes changes))
(rx/of (dch/commit-changes (assoc changes ;; TODO a ver qué pasa con esto (rx/of (dch/commit-changes (assoc changes ;; TODO a ver qué pasa con esto
:file-id file-id)))) :file-id file-id))))

View file

@ -576,3 +576,6 @@
(def specialized-panel (def specialized-panel
(l/derived :specialized-panel st/state)) (l/derived :specialized-panel st/state))
(def updating-library
(l/derived :updating-library st/state))

View file

@ -441,9 +441,8 @@
{::mf/wrap-props false} {::mf/wrap-props false}
[{:keys [file-id file-data libraries]}] [{:keys [file-id file-data libraries]}]
(let [summary?* (mf/use-state true) (let [summary?* (mf/use-state true)
updating?* (mf/use-state false)
summary? (deref summary?*) summary? (deref summary?*)
updating? (deref updating?*) updating? (mf/deref refs/updating-library)
see-all-assets see-all-assets
(mf/use-fn (mf/use-fn
@ -467,8 +466,9 @@
(let [library-id (some-> (dom/get-target event) (let [library-id (some-> (dom/get-target event)
(dom/get-data "library-id") (dom/get-data "library-id")
(parse-uuid))] (parse-uuid))]
(reset! updating?* true) (st/emit!
(st/emit! (dwl/sync-file file-id library-id))))))] (dwl/set-updating-library true)
(dwl/sync-file file-id library-id))))))]
(if new-css-system (if new-css-system
[:div {:class (stl/css :section)} [:div {:class (stl/css :section)}