mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 10:56:32 +00:00
fix(rtc): refresh ui component after asset-file writing finished
This commit is contained in:
@@ -1045,9 +1045,10 @@
|
||||
{:keys [direction loaded total]} (state/sub :rtc/asset-upload-download-progress
|
||||
{:path-in-sub-atom [repo (str (:block/uuid block))]})
|
||||
downloading? (and (= direction :download) (not= loaded total))
|
||||
download-finished? (and (= direction :download) (= loaded total))]
|
||||
asset-file-write-finished? (state/sub :assets/asset-file-write-finish
|
||||
{:path-in-sub-atom [repo (str (:block/uuid block))]})]
|
||||
(cond
|
||||
(or file-exists? download-finished?)
|
||||
(or file-exists? asset-file-write-finished?)
|
||||
(asset-link (assoc config :asset-block block)
|
||||
(:block/title block)
|
||||
(path/path-join (str "../" common-config/local-assets-dir) file)
|
||||
|
||||
@@ -249,7 +249,11 @@
|
||||
repo-dir (config/get-repo-dir repo)
|
||||
file-path (path/path-join common-config/local-assets-dir
|
||||
(str asset-block-id-str "." asset-type))]
|
||||
(fs/write-plain-text-file! repo repo-dir file-path data {})))
|
||||
(p/do!
|
||||
(fs/write-plain-text-file! repo repo-dir file-path data {})
|
||||
(state/update-state!
|
||||
:assets/asset-file-write-finish
|
||||
(fn [m] (assoc-in m [repo asset-block-id-str] (common-util/time-ms)))))))
|
||||
|
||||
(defn <unlink-asset
|
||||
[repo asset-block-id asset-type]
|
||||
|
||||
@@ -209,6 +209,7 @@
|
||||
;; assets
|
||||
:assets/alias-enabled? (or (storage/get :assets/alias-enabled?) false)
|
||||
:assets/alias-dirs (or (storage/get :assets/alias-dirs) [])
|
||||
:assets/asset-file-write-finish (atom {})
|
||||
|
||||
;; mobile
|
||||
:mobile/container-urls nil
|
||||
|
||||
Reference in New Issue
Block a user