Skip to content

Commit

Permalink
enhance(pdf): UI lag for the case of large highlights data
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 authored and tiensonqin committed Mar 9, 2023
1 parent e52bda8 commit 22dfa62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
instaparse/instaparse {:mvn/version "1.4.10"}
org.clojars.mmb90/cljs-cache {:mvn/version "0.1.4"}
logseq/graph-parser {:local/root "deps/graph-parser"}
metosin/malli {:mvn/version "0.10.0"}}
metosin/malli {:mvn/version "0.10.0"}
fipp/fipp {:mvn/version "0.6.26"}}

:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.54"}
Expand Down
6 changes: 3 additions & 3 deletions src/main/frontend/extensions/pdf/assets.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns frontend.extensions.pdf.assets
(:require [cljs.reader :as reader]
[clojure.string :as string]
[cljs.pprint :as pprint]
[frontend.config :as config]
[frontend.db.model :as db-model]
[frontend.db.utils :as db-utils]
Expand All @@ -23,7 +22,8 @@
[medley.core :as medley]
[promesa.core :as p]
[reitit.frontend.easy :as rfe]
[rum.core :as rum]))
[rum.core :as rum]
[fipp.edn :refer [pprint]]))

(defn inflate-asset
[original-path]
Expand Down Expand Up @@ -64,7 +64,7 @@
(when hls-file
(let [repo-cur (state/get-current-repo)
repo-dir (config/get-repo-dir repo-cur)
data (with-out-str (pprint/pprint {:highlights highlights :extra extra}))]
data (with-out-str (pprint {:highlights highlights :extra extra}))]
(fs/write-file! repo-cur repo-dir hls-file data {:skip-compare? true}))))

(defn resolve-hls-data-by-key$
Expand Down
6 changes: 4 additions & 2 deletions src/main/frontend/extensions/pdf/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,10 @@
(when (= :completed (:status loader-state))
(p/catch
(when-not (:error hls-state)
(pdf-assets/persist-hls-data$
pdf-current (:latest-hls hls-state) (:extra hls-state)))
(p/do!
(p/delay 100)
(pdf-assets/persist-hls-data$
pdf-current (:latest-hls hls-state) (:extra hls-state))))

;; write hls file error
(fn [e]
Expand Down

0 comments on commit 22dfa62

Please sign in to comment.