diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 8ff79963e..8cf161baa 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -4,16 +4,7 @@ ;; :used-underscored-binding is turned off for components because of false positive ;; for rum/defcs and _state. {all-components - {:linters {:used-underscored-binding {:level :off} - ;; TODO: Apply this to all of frontend - :shadowed-var {:level :warning - ;; FIXME: Remove most of these as shadowing core fns isn't a good practice - :exclude [t name binding type uuid key val time fn ex-data list - keys vals sort-by namespace count parents int? hash subs - load-file exists? rest object? min max class array range string? delay? - new var re-pattern update iter ns char resolve sequence identity - dispatch-fn identity comp max-key vec meta next delay str vector list? chars - chunk test]}}} + {:linters {:used-underscored-binding {:level :off}}} ;; false positive with match/match and _ frontend.handler.paste {:linters {:used-underscored-binding {:level :off}}} frontend.db {:linters {:aliased-namespace-symbol @@ -23,6 +14,14 @@ {:path-invalid-construct/string-join {:level :info} :regex-checks/double-escaped-regex {:level :warning} :aliased-namespace-symbol {:level :warning} + :shadowed-var {:level :warning + :exclude [key val name binding type uuid + ;; FIXME: Remove the shadowed below as shadowing core fns isn't a good practice + ;; FIXME: At least remove the first two lines as they have few uses + re-pattern sequence dispatch-fn comp vec delay chunk + fn t ex-data list int? hash range + time sort-by namespace count parents exists? min + new var ns resolve identity next meta vals keys exists?]} ;; Disable until it doesn't trigger false positives on rum/defcontext :earmuffed-var-not-dynamic {:level :off} ;; Disable until we decide to use conj! as recommended in docs diff --git a/src/electron/electron/utils.cljs b/src/electron/electron/utils.cljs index 978eaf4af..6bde2ad56 100644 --- a/src/electron/electron/utils.cljs +++ b/src/electron/electron/utils.cljs @@ -209,10 +209,10 @@ (defn save-proxy-settings "Save proxy settings to configs.edn" - [{:keys [type host port test] :or {type "system"}}] + [{test' :test :keys [type host port] :or {type "system"}}] (if (or (= type "system") (= type "direct")) - (cfgs/set-item! :settings/agent {:type type :test test}) - (cfgs/set-item! :settings/agent {:type type :protocol type :host host :port port :test test}))) + (cfgs/set-item! :settings/agent {:type type :test test'}) + (cfgs/set-item! :settings/agent {:type type :protocol type :host host :port port :test test'}))) (defn should-read-content? "Skip reading content of file while using file-watcher" diff --git a/src/main/frontend/commands.cljs b/src/main/frontend/commands.cljs index 262cfaec5..26ab33392 100644 --- a/src/main/frontend/commands.cljs +++ b/src/main/frontend/commands.cljs @@ -839,8 +839,8 @@ (prn "No handler for step: " type)) (defn handle-steps - [vector format] - (doseq [step vector] + [vector' format] + (doseq [step vector'] (handle-step step format))) (defn exec-plugin-simple-command! diff --git a/src/main/frontend/common/search_fuzzy.cljs b/src/main/frontend/common/search_fuzzy.cljs index fb08b45d5..d57778b64 100644 --- a/src/main/frontend/common/search_fuzzy.cljs +++ b/src/main/frontend/common/search_fuzzy.cljs @@ -31,9 +31,9 @@ (defn score [oquery ostr] (let [query (clean-str oquery) - str (clean-str ostr)] + s (clean-str ostr)] (loop [q (seq (char-array query)) - s (seq (char-array str)) + s (seq (char-array s)) mult 1 idx MAX-STRING-LENGTH score' 0] @@ -41,7 +41,7 @@ ;; add str-len-distance to score, so strings with matches in same position get sorted by length ;; boost score if we have an exact match including punctuation (empty? q) (+ score' - (str-len-distance query str) + (str-len-distance query s) (if (<= 0 (.indexOf ostr oquery)) MAX-STRING-LENGTH 0)) (empty? s) 0 :else (if (= (first q) (first s)) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 0fccf04ad..4dba1005a 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -3267,10 +3267,10 @@ [config {:keys [name content checkbox items number] :as _list}] (let [content (when-not (empty? content) (match content - [["Paragraph" i] & rest] + [["Paragraph" i] & rest'] (vec-cat (map-inline config i) - (markup-elements-cp config rest)) + (markup-elements-cp config rest')) :else (markup-elements-cp config content))) checked? (some? checkbox) diff --git a/src/main/frontend/components/file_sync.cljs b/src/main/frontend/components/file_sync.cljs index f53e8f90e..86c08dadc 100644 --- a/src/main/frontend/components/file_sync.cljs +++ b/src/main/frontend/components/file_sync.cljs @@ -645,7 +645,7 @@ (js/setTimeout (fn [] (set-content-ready? true)) 100)) ;; without cache - (let [load-file (fn [repo-url file] + (let [load-file' (fn [repo-url file] (-> (fs-util/read-repo-file repo-url file) (p/then (fn [content] @@ -657,11 +657,11 @@ (async/go (let [downloaded-path (async/ (bn/BigNumber 0.5) (.shiftedBy (- places))) upper-bound (bn/BigNumber 1e21)] (and (-> mag (.isGreaterThanOrEqualTo lower-bound)) @@ -146,9 +146,9 @@ (defn can-fit? "Check that number can render normally within the given number of digits. Tolerance allows for leading zeros in a decimal fraction." - [num digits tolerance] - (and (< (.-e num) digits) - (.isInteger (.shiftedBy num (+ tolerance digits))))) + [num' digits tolerance] + (and (< (.-e num') digits) + (.isInteger (.shiftedBy num' (+ tolerance digits))))) (defn format-base [val base] (let [sign (.-s val) diff --git a/src/main/frontend/extensions/code.cljs b/src/main/frontend/extensions/code.cljs index c40ff22e9..bd248ac8a 100644 --- a/src/main/frontend/extensions/code.cljs +++ b/src/main/frontend/extensions/code.cljs @@ -520,16 +520,16 @@ :did-update (fn [state] (let [next-theme (get-theme!) last-theme @(:last-theme state) - editor (some-> state :editor-atom deref)] - (when (and editor (not= next-theme last-theme)) + editor' (some-> state :editor-atom deref)] + (when (and editor' (not= next-theme last-theme)) (reset! (:last-theme state) next-theme) - (.setOption editor "theme" next-theme))) + (.setOption editor' "theme" next-theme))) (reset! (:code-options state) (last (:rum/args state))) (when-not (:file? (first (:rum/args state))) (let [code (nth (:rum/args state) 3) - editor @(:editor-atom state)] - (when (and editor (not= (.getValue editor) code)) - (.setValue editor code)))) + editor' @(:editor-atom state)] + (when (and editor' (not= (.getValue editor') code)) + (.setValue editor' code)))) state)} [state _config id attr code _theme _options] [:div.extensions__code diff --git a/src/main/frontend/extensions/html_parser.cljs b/src/main/frontend/extensions/html_parser.cljs index 306f88b92..78316ca6d 100644 --- a/src/main/frontend/extensions/html_parser.cljs +++ b/src/main/frontend/extensions/html_parser.cljs @@ -33,8 +33,8 @@ block-pattern (if (= format :markdown) "#" (config/get-block-pattern format)) - map-join (fn [children & {:keys [list?]}] - (let [opts' (if list? + map-join (fn [children & {list?' :list?}] + (let [opts' (if list?' (let [level (inc (or (:level opts) 0))] (assoc opts :level level)) opts)] diff --git a/src/main/frontend/extensions/srs.cljs b/src/main/frontend/extensions/srs.cljs index 2a6207301..f2e539520 100644 --- a/src/main/frontend/extensions/srs.cljs +++ b/src/main/frontend/extensions/srs.cljs @@ -70,7 +70,7 @@ "any number between 0 and 1 (the greater it is the faster the changes of the OF matrix)" 0.5) -(defn- learning-fraction [] +(defn- get-learning-fraction [] (if-let [learning-fraction (:srs/learning-fraction (state/get-config))] (if (and (number? learning-fraction) (< learning-fraction 1) @@ -79,11 +79,11 @@ learning-fraction-default) learning-fraction-default)) -(def of-matrix (persist-var/persist-var nil "srs-of-matrix")) +(def srs-of-matrix (persist-var/persist-var nil "srs-of-matrix")) (def initial-interval-default 4) -(defn- initial-interval [] +(defn- get-initial-interval [] (if-let [initial-interval (:srs/initial-interval (state/get-config))] (if (and (number? initial-interval) (> initial-interval 0)) @@ -147,7 +147,7 @@ (defn- get-of [of-matrix n ef] (or (get-in of-matrix [n ef]) (if (<= n 1) - (initial-interval) + (get-initial-interval) ef))) (defn- set-of [of-matrix n ef of] @@ -162,25 +162,25 @@ (* (get-of of-matrix n ef) (interval (- n 1) ef of-matrix)))) -(defn- next-ef +(defn- get-next-ef [ef quality] (let [ef* (+ ef (- 0.1 (* (- 5 quality) (+ 0.08 (* 0.02 (- 5 quality))))))] (if (< ef* 1.3) 1.3 ef*))) -(defn- next-of-matrix +(defn- get-next-of-matrix [of-matrix n quality fraction ef] (let [of (get-of of-matrix n ef) of* (* of (+ 0.72 (* quality 0.07))) of** (+ (* (- 1 fraction) of) (* of* fraction))] (set-of of-matrix n ef of**))) -(defn next-interval +(defn calc-next-interval "return [next-interval repeats next-ef of-matrix]" [_last-interval repeats ef quality of-matrix] (assert (and (<= quality 5) (>= quality 0))) (let [ef (or ef 2.5) - next-ef (next-ef ef quality) - next-of-matrix (next-of-matrix of-matrix repeats quality (learning-fraction) ef) + next-ef (get-next-ef ef quality) + next-of-matrix (get-next-of-matrix of-matrix repeats quality (get-learning-fraction) ef) next-interval (interval repeats next-ef next-of-matrix)] (if (< quality 3) @@ -272,15 +272,15 @@ (string/starts-with? query-string "[")) (page-ref/->page-ref (string/trim query-string)) query-string) - {:keys [query sort-by rules]} (query-dsl/parse query-string {:db-graph? (config/db-based-graph? repo)}) - query* (util/concat-without-nil + {query* :query :keys [sort-by rules]} (query-dsl/parse query-string {:db-graph? (config/db-based-graph? repo)}) + query** (util/concat-without-nil [['?b :block/refs '?br] ['?br :block/name card-hash-tag]] - (if (coll? (first query)) query [query]))] - (when-let [query (query-dsl/query-wrapper query* - {:blocks? true - :block-attrs [:db/id :block/properties]})] + (if (coll? (first query*)) query* [query*]))] + (when-let [query' (query-dsl/query-wrapper query** + {:blocks? true + :block-attrs [:db/id :block/properties]})] (let [result (query-react/react-query repo - {:query (with-meta query {:cards-query? true}) + {:query (with-meta query' {:cards-query? true}) :rules (or rules [])} (merge {:use-cache? use-cache?} @@ -330,7 +330,7 @@ last-ef (or (when-let [v (get props card-last-easiness-factor-property)] (util/safe-parse-float v)) 2.5) [next-interval next-repeats next-ef of-matrix*] - (next-interval last-interval repeats last-ef score @of-matrix) + (calc-next-interval last-interval repeats last-ef score @srs-of-matrix) next-interval* (if (< next-interval 0) 0 next-interval) next-schedule (tc/to-string (t/plus (tl/local-now) (t/hours (* 24 next-interval*)))) now (tc/to-string (tl/local-now))] @@ -349,7 +349,7 @@ (let [block (.-block card) result (get-next-interval card score) next-of-matrix (:next-of-matrix result)] - (reset! of-matrix next-of-matrix) + (reset! srs-of-matrix next-of-matrix) (save-block-card-properties! (db/pull (:db/id block)) (select-keys result [card-last-interval-property @@ -617,7 +617,7 @@ (when-not @*preview-mode? (operation-card-info-summary! review-records review-cards card-query-block) - (persist-var/persist-save of-matrix)))] + (persist-var/persist-save srs-of-matrix)))] [:div.flex-1.cards-review {:style (when modal? {:height "100%"})} [:div.flex.flex-row.items-center.justify-between.cards-title [:div.flex.flex-row.items-center @@ -632,9 +632,9 @@ [:span {:style {:margin-top 2}} (svg/caret-down)]]]) (fn [{:keys [toggle-fn]}] - (cards-select {:on-chosen (fn [query] - (let [query' (if (= query (t :flashcards/modal-select-all)) "" query)] - (reset! query-atom query') + (cards-select {:on-chosen (fn [query'] + (let [query'' (if (= query' (t :flashcards/modal-select-all)) "" query')] + (reset! query-atom query'') (toggle-fn)))})) {:modal-class (util/hiccup->class "origin-top-right.absolute.left-0.mt-2.ml-2.rounded-md.shadow-lg")})] @@ -822,5 +822,5 @@ (js/setTimeout f 1000) (when (nil? @*due-cards-interval) ;; refresh every hour - (let [interval (js/setInterval f (* 3600 1000))] - (reset! *due-cards-interval interval)))))) + (let [interval' (js/setInterval f (* 3600 1000))] + (reset! *due-cards-interval interval')))))) diff --git a/src/main/frontend/extensions/video/youtube.cljs b/src/main/frontend/extensions/video/youtube.cljs index 6fe684a5e..4f94912b0 100644 --- a/src/main/frontend/extensions/video/youtube.cljs +++ b/src/main/frontend/extensions/video/youtube.cljs @@ -122,13 +122,13 @@ Remember: You can paste a raw YouTube url as embedded video on mobile." nil))) -(defn parse-timestamp [timestamp] +(defn parse-timestamp [timestamp'] (let [reg #"^(?:(\d+):)?([0-5]?\d):([0-5]?\d)$" reg-number #"^\d+$" - timestamp (str timestamp) - total-seconds (some-> (re-matches reg-number timestamp) + timestamp'' (str timestamp') + total-seconds (some-> (re-matches reg-number timestamp'') util/safe-parse-int) - [_ hours minutes seconds] (re-matches reg timestamp) + [_ hours minutes seconds] (re-matches reg timestamp'') [hours minutes seconds] (map #(if (nil? %) 0 (util/safe-parse-int %)) [hours minutes seconds])] (cond total-seconds diff --git a/src/main/frontend/extensions/zotero.cljs b/src/main/frontend/extensions/zotero.cljs index 025663c81..14874e16e 100644 --- a/src/main/frontend/extensions/zotero.cljs +++ b/src/main/frontend/extensions/zotero.cljs @@ -384,7 +384,7 @@ :on-click (fn [] (p/let [_ (setting/remove-profile @profile*)] - (reset! profile* (setting/profile)))))]]) + (reset! profile* (setting/get-profile)))))]]) (rum/defcs add-all-items < (rum/local nil ::progress) @@ -447,7 +447,7 @@ (rum/defcs settings < (rum/local (setting/all-profiles) ::all-profiles) - (rum/local (setting/profile) ::profile) + (rum/local (setting/get-profile) ::profile) rum/reactive {:should-update (fn [old-state _new-state] diff --git a/src/main/frontend/extensions/zotero/api.cljs b/src/main/frontend/extensions/zotero/api.cljs index c6e9d777b..e1558c12e 100644 --- a/src/main/frontend/extensions/zotero/api.cljs +++ b/src/main/frontend/extensions/zotero/api.cljs @@ -2,8 +2,8 @@ (:require [camel-snake-kebab.core :as csk] [camel-snake-kebab.extras :as cske] [cljs-http.client :as http] - [cljs.core.async - :refer [! alt! chan close! go go-loop timeout]] + [cljs.core.async :as async + :refer [! alt! chan close! go go-loop]] [clojure.string :as str] [frontend.util :as util] [frontend.extensions.zotero.setting :as setting])) @@ -26,7 +26,7 @@ (let [out (chan)] (go-loop [last-val nil] (let [val (if (nil? last-val) ( (cske/transform-keys csk/->kebab-case-keyword headers) :total-results util/safe-parse-int)) ;; "/users/475425/collections?v=3" (defn get* - ([config api] - (get* config api nil)) - ([config api query-params] - (go (let [{:keys [api-version base type type-id api-key timeout]} config + ([config' api] + (get* config' api nil)) + ([config' api query-params] + (go (let [{:keys [api-version base type type-id api-key timeout]} config' {:keys [success body headers] :as response} (kebab-case-keyword body) next-start (parse-start headers :next) prev-start (parse-start headers :prev) - results-count (results-count headers)] + results-count (get-results-count headers)] (cond-> {:result result} next-start (assoc :next next-start) diff --git a/src/main/frontend/extensions/zotero/extractor.cljs b/src/main/frontend/extensions/zotero/extractor.cljs index 8975c1e92..8209cce75 100644 --- a/src/main/frontend/extensions/zotero/extractor.cljs +++ b/src/main/frontend/extensions/zotero/extractor.cljs @@ -21,11 +21,11 @@ (when citation (string/trim (string/replace citation "Citation Key: " ""))))) -(defn title [item] (-> item :data :title)) +(defn ->title [item] (-> item :data :title)) -(defn item-key [item] (:key item)) +(defn ->item-key [item] (:key item)) -(defn page-name [item] +(defn ->page-name [item] (let [page-title (case (item-type item) "case" @@ -35,14 +35,14 @@ "statute" (-> item :data :name-of-act) ;; default use title - (title item)) + (->title item)) citekey (citation-key item)] (if (and (setting/setting :prefer-citekey?) (not (string/blank? citekey))) (str (setting/setting :page-insert-prefix) citekey) (str (setting/setting :page-insert-prefix) page-title)))) -(defn authors [item] +(defn ->authors [item] (let [creators (-> item :data :creators) authors (into [] @@ -53,7 +53,7 @@ creators)] (distinct authors))) -(defn tags [item] +(defn ->tags [item] (let [tags (->> (-> item :data :tags) (mapv (fn [{:keys [tag]}] (string/trim tag))) @@ -115,11 +115,11 @@ ", " (markdown-link "Web library" (web-link item)))) -(defn properties [item] +(defn ->properties [item] (let [type (item-type item) fields (schema/fields type) - authors (authors item) - tags (tags item) + authors (->authors item) + tags (->tags item) links (zotero-links item) date (date->journal item) data (-> item :data @@ -133,7 +133,7 @@ :item-type (page-ref/->page-ref type)) (dissoc :creators :abstract-note) (rename-keys {:title :original-title}) - (assoc :title (page-name item)))] + (assoc :title (->page-name item)))] (->> data (remove (comp (fn [v] (or (string/blank? v) (empty? v))) second)) (into {})))) @@ -157,7 +157,7 @@ (str (markdown-link title (local-link item)) " " - (zotero-imported-file-macro (item-key item) filename)) + (zotero-imported-file-macro (->item-key item) filename)) "linked_file" (str (markdown-link title (local-link item)) @@ -167,14 +167,14 @@ (str (markdown-link title url) " " - (zotero-imported-file-macro (item-key item) filename)) + (zotero-imported-file-macro (->item-key item) filename)) "linked_url" (markdown-link title url)))) (defmethod extract :default [item] - (let [page-name (page-name item) - properties (properties item) + (let [page-name (->page-name item) + properties (->properties item) abstract-note (-> item :data :abstract-note)] {:page-name page-name :properties properties diff --git a/src/main/frontend/extensions/zotero/setting.cljs b/src/main/frontend/extensions/zotero/setting.cljs index 4be139952..0c069c2df 100644 --- a/src/main/frontend/extensions/zotero/setting.cljs +++ b/src/main/frontend/extensions/zotero/setting.cljs @@ -27,17 +27,17 @@ default #{"default"}] (if (empty? profiles) default profiles))) -(defn profile [] +(defn get-profile [] (let [profile (storage/get :zotero/setting-profile)] (if (and profile (contains? (all-profiles) profile)) profile (first (all-profiles))))) (defn api-key [] - (get (storage/get :zotero/api-key-v2) (profile))) + (get (storage/get :zotero/api-key-v2) (get-profile))) (defn set-api-key [key] - (let [profile (profile) + (let [profile (get-profile) api-key-map (storage/get :zotero/api-key-v2)] (storage/set :zotero/api-key-v2 (assoc api-key-map profile key)))) @@ -57,14 +57,14 @@ (config-handler/set-config! :zotero/settings-v2 settings))) (defn set-setting! [k v] - (let [profile (profile) + (let [profile (get-profile) new-settings (update (sub-zotero-config) profile #(assoc % k v))] (config-handler/set-config! :zotero/settings-v2 new-settings))) (defn setting [k] - (let [profile (profile)] + (let [profile (get-profile)] (-> (sub-zotero-config) (get profile) (get k (get default-settings k))))) diff --git a/src/main/frontend/fs.cljs b/src/main/frontend/fs.cljs index f1606e9fc..d7215c23e 100644 --- a/src/main/frontend/fs.cljs +++ b/src/main/frontend/fs.cljs @@ -234,12 +234,12 @@ ([fpath] (util/p-handle (stat fpath) - (fn [stat] (not (nil? stat))) + (fn [stat'] (not (nil? stat'))) (fn [_e] false))) ([dir path] (util/p-handle (stat dir path) - (fn [stat] (not (nil? stat))) + (fn [stat'] (not (nil? stat'))) (fn [_e] false)))) (defn asset-href-exists? diff --git a/src/main/frontend/fs/capacitor_fs.cljs b/src/main/frontend/fs/capacitor_fs.cljs index 20942d59b..2822c9923 100644 --- a/src/main/frontend/fs/capacitor_fs.cljs +++ b/src/main/frontend/fs/capacitor_fs.cljs @@ -145,7 +145,7 @@ (concat (rest dirs) files-dir)))))] (js->clj result :keywordize-keys true))) -(defn- contents-matched? +(defn- (p/let [result ( (js->clj stat :keywordize-keys true) diff --git a/src/main/frontend/fs/nfs.cljs b/src/main/frontend/fs/nfs.cljs index 063f51751..fac2f5d9f 100644 --- a/src/main/frontend/fs/nfs.cljs +++ b/src/main/frontend/fs/nfs.cljs @@ -249,11 +249,11 @@ (p/let [local-file (.getFile file-handle) disk-content (.text local-file) db-content (db/get-file repo path) - contents-matched? (contents-matched? disk-content db-content)] + contents-matched?' (contents-matched? disk-content db-content)] (if (and (not (string/blank? db-content)) (not (:skip-compare? opts)) - (not contents-matched?) + (not contents-matched?') (not (contains? #{"excalidraw" "edn" "css"} ext)) (not (string/includes? path "/.recycle/"))) (state/pub-event! [:file/not-matched-from-disk path disk-content content]) diff --git a/src/main/frontend/fs/node.cljs b/src/main/frontend/fs/node.cljs index 63bd2ed62..227cd7cd5 100644 --- a/src/main/frontend/fs/node.cljs +++ b/src/main/frontend/fs/node.cljs @@ -12,7 +12,7 @@ [promesa.core :as p] [logseq.common.path :as path])) -(defn- contents-matched? +(defn- (p/let [result (ipc/ipc "writeFile" repo file-fpath content) mtime (gobj/get result "mtime")] diff --git a/src/main/frontend/fs/sync.cljs b/src/main/frontend/fs/sync.cljs index 2e20beceb..d3075ee50 100644 --- a/src/main/frontend/fs/sync.cljs +++ b/src/main/frontend/fs/sync.cljs @@ -542,11 +542,11 @@ (partition-filetxns n))) (defn- filepath+checksum->diff - [index {:keys [relative-path checksum user-uuid graph-uuid]}] + [index {relative-path' :relative-path :keys [checksum user-uuid graph-uuid]}] {:post [(s/valid? ::diff %)]} {:TXId (inc index) :TXType "update_files" - :TXContent [[(util/string-join-path [user-uuid graph-uuid relative-path]) nil checksum]]}) + :TXContent [[(util/string-join-path [user-uuid graph-uuid relative-path']) nil checksum]]}) (defn filepath+checksum-coll->partitioned-filetxns "transducer. @@ -1451,14 +1451,14 @@ (= #{:value :expired-at} (set (keys v)))]} (swap! *get-graph-salt-memoize-cache conj [graph-uuid v])) -(defn LocalSyncer [user-uuid graph-uuid base-path repo *txid *txid-for-get-deletion-log *sync-state remoteapi + Remote->LocalSyncer [user-uuid graph-uuid base-path repo *txid *txid-for-get-deletion-log *sync-state remoteapi' ^:mutable local->remote-syncer *stopped *paused] Object (set-local->remote-syncer! [_ s] (set! local->remote-syncer s)) @@ -2442,7 +2442,7 @@ (local! [_] (go (let [r - (let [diff-r ( (dec min-txid) @*txid) ;; min-txid-1 > @*txid, need to remote->local-full-sync @@ -2479,7 +2479,7 @@ (local-all-files! [this] (go - (let [remote-all-files-meta-c ( diff-remote-files) - remote-txid-or-ex (RemoteSyncer [user-uuid graph-uuid base-path repo *sync-state remoteapi + Local->RemoteSyncer [user-uuid graph-uuid base-path repo *sync-state remoteapi' ^:mutable rate *txid *txid-for-get-deletion-log ^:mutable remote->local-syncer stop-chan *stopped *paused ;; control chans @@ -2739,7 +2739,7 @@ (need-reset-local-txid? r*) ;; TODO: this cond shouldn't be true, ;; but some potential bugs cause local-txid > remote-txid - (let [remote-txid-or-ex (remote-all-files! [this] (go - (let [remote-all-files-meta-c (RemoteSyncer local->remote-syncer ^Remote->LocalSyncer remote->local-syncer remoteapi + ^Local->RemoteSyncer local->remote-syncer ^Remote->LocalSyncer remote->local-syncer remoteapi' ^:mutable ratelimit-local-changes-chan *txid *txid-for-get-deletion-log ^:mutable state ^:mutable remote-change-chan ^:mutable *ws *stopped? *paused? @@ -2949,7 +2949,7 @@ remote->local (let [txid (if (true? remote->local) - (let [r (local)] (when (some? txid) @@ -3399,7 +3399,7 @@ ( current-level 1) + indent' (when (> current-level 1) (indent (dec current-level) 0)) items* (block-list items :in-list? true)] - (concatv [indent number* checkbox* space] + (concatv [indent' number* checkbox* space] content* [(newline* 1)] items* @@ -87,10 +87,10 @@ [properties] (when-not (get-in *state* [:export-options :remove-properties?]) (let [level (dec (get *state* :current-level 1)) - indent (indent-with-2-spaces level)] + indent' (indent-with-2-spaces level)] (reduce (fn [r [k v]] - (conj r indent (raw-text k "::") space (raw-text v) (newline* 1))) + (conj r indent' (raw-text k "::") space (raw-text v) (newline* 1))) [] properties)))) (defn- block-example diff --git a/src/main/frontend/handler/page.cljs b/src/main/frontend/handler/page.cljs index 876350359..17643f338 100644 --- a/src/main/frontend/handler/page.cljs +++ b/src/main/frontend/handler/page.cljs @@ -129,10 +129,9 @@ (defn toggle-favorite! [] ;; NOTE: in journals or settings, current-page is nil (when-let [page-name (state/get-current-page)] - (let [favorited? (favorited? page-name)] - (if favorited? - ( base-upgrade-url - user-uuid (str "?checkout[custom][user_uuid]=" (name user-uuid)))] + user-uuid' (str "?checkout[custom][user_uuid]=" (name user-uuid')))] (println " ~~~ LEMON: " url " ~~~ ") (js/window.open url))) ; (js/window.open diff --git a/src/main/frontend/handler/whiteboard.cljs b/src/main/frontend/handler/whiteboard.cljs index dcea56c6d..0e8145fc9 100644 --- a/src/main/frontend/handler/whiteboard.cljs +++ b/src/main/frontend/handler/whiteboard.cljs @@ -118,8 +118,8 @@ (remove string/blank?) (set)) new-orders (when (seq created-ids) - (let [max-key (last (sort (map :block/order (:block/_page page-entity))))] - (db-order/gen-n-keys (count created-ids) max-key nil))) + (let [max-key' (last (sort (map :block/order (:block/_page page-entity))))] + (db-order/gen-n-keys (count created-ids) max-key' nil))) new-id->order (when (seq created-ids) (zipmap created-ids new-orders)) created-shapes (set (filter #(created-ids (:id %)) upsert-shapes)) deleted-ids (->> (set/difference old-ids new-ids) diff --git a/src/main/frontend/mixins.cljs b/src/main/frontend/mixins.cljs index 640fa235b..1f73ef66b 100644 --- a/src/main/frontend/mixins.cljs +++ b/src/main/frontend/mixins.cljs @@ -58,13 +58,13 @@ nil)))) (defn on-enter - [state & {:keys [on-enter node]}] + [state & {on-enter-fn :on-enter :keys [node]}] (let [node (or node (rum/dom-node state))] (listen state node "keyup" (fn [e] (case (.-keyCode e) ;; Enter - 13 (on-enter e) + 13 (on-enter-fn e) nil))))) (defn on-key-up diff --git a/src/main/frontend/mobile/mobile_bar.cljs b/src/main/frontend/mobile/mobile_bar.cljs index 45b6530c9..2b09806db 100644 --- a/src/main/frontend/mobile/mobile_bar.cljs +++ b/src/main/frontend/mobile/mobile_bar.cljs @@ -91,7 +91,7 @@ (or (state/sub :mobile/show-toolbar?) (mobile-util/native-ipad?))) (let [parent-id (state/get-edit-input-id) - commands (commands parent-id)] + commands' (commands parent-id)] [:div#mobile-editor-toolbar.bg-base-2 [:div.toolbar-commands (indent-outdent false "indent-decrease") @@ -112,7 +112,7 @@ (command history/undo! {:icon "rotate" :class "rotate-180"} true) (command history/redo! {:icon "rotate-clockwise" :class "rotate-180"} true) (timestamp-submenu parent-id) - (for [command commands] - command)] + (for [command' commands'] + command')] [:div.toolbar-hide-keyboard (command #(state/clear-edit!) {:icon "keyboard-show"})]]))) diff --git a/src/main/frontend/modules/instrumentation/sentry.cljs b/src/main/frontend/modules/instrumentation/sentry.cljs index 70a78abdc..c3ed89ee8 100644 --- a/src/main/frontend/modules/instrumentation/sentry.cljs +++ b/src/main/frontend/modules/instrumentation/sentry.cljs @@ -60,8 +60,8 @@ (defn init [] (when (and (not config/dev?) (not-empty SENTRY-DSN)) - (let [config (clj->js config)] - (Sentry/init config)))) + (let [config' (clj->js config)] + (Sentry/init config')))) (defn set-user! [id] diff --git a/src/main/frontend/ui.cljs b/src/main/frontend/ui.cljs index 739963ae0..b35b93b30 100644 --- a/src/main/frontend/ui.cljs +++ b/src/main/frontend/ui.cljs @@ -240,7 +240,7 @@ (let [links-children (let [links (if (fn? links) (links) links) links (remove nil? links)] - (for [{:keys [options title icon key hr hover-detail item _as-link?]} links] + (for [{icon' :icon :keys [options title key hr hover-detail item _as-link?]} links] (let [new-options (merge options (cond-> @@ -255,7 +255,7 @@ nil (or item [:div.flex.items-center - (when icon icon) + (when icon' icon') [:div.title-wrap {:style {:margin-right "8px" :margin-left "4px"}} title]]))] (if hr @@ -587,7 +587,7 @@ :on-click #(when close-backdrop? (close-fn))} [:div.absolute.inset-0.opacity-75]]) -(rum/defc modal-panel-content < +(rum/defc modal-panel-content-cp < mixins/component-editing-mode [panel-content close-fn] (panel-content close-fn)) @@ -620,7 +620,7 @@ [:div (cond-> {:class (if fullscreen? "" "panel-content")} (seq style) (assoc :style style)) - (modal-panel-content panel-content close-fn)])]) + (modal-panel-content-cp panel-content close-fn)])]) (rum/defc modal < rum/reactive (mixins/event-mixin @@ -670,15 +670,15 @@ (rum/defc sub-modal < rum/reactive [] (when-let [modals (seq (state/sub :modal/subsets))] - (for [[idx modal] (medley/indexed modals)] - (let [id (:modal/id modal) - modal-panel-content (:modal/panel-content modal) - close-btn? (:modal/close-btn? modal) - close-backdrop? (:modal/close-backdrop? modal) - show? (:modal/show? modal) - label (:modal/label modal) - style (:modal/style modal) - class (:modal/class modal) + (for [[idx modal'] (medley/indexed modals)] + (let [id (:modal/id modal') + modal-panel-content (:modal/panel-content modal') + close-btn? (:modal/close-btn? modal') + close-backdrop? (:modal/close-backdrop? modal') + show? (:modal/show? modal') + label (:modal/label modal') + style (:modal/style modal') + class (:modal/class modal') close-fn (fn [] (state/close-sub-modal! id)) modal-panel-content (or modal-panel-content (fn [_close] [:div]))] @@ -770,17 +770,17 @@ (rum/defc admonition [type content] (let [type (name type)] - (when-let [icon (case (string/lower-case type) - "note" svg/note - "tip" svg/tip - "important" svg/important - "caution" svg/caution - "warning" svg/warning - "pinned" svg/pinned - nil)] + (when-let [icon' (case (string/lower-case type) + "note" svg/note + "tip" svg/tip + "important" svg/important + "caution" svg/caution + "warning" svg/warning + "pinned" svg/pinned + nil)] [:div.flex.flex-row.admonitionblock.align-items {:class type} [:div.pr-4.admonition-icon.flex.flex-col.justify-center - {:title (string/capitalize type)} (icon)] + {:title (string/capitalize type)} (icon')] [:div.ml-4.text-lg content]]))) @@ -933,7 +933,7 @@ (rum/defcs slider < rum/reactive {:init (fn [state] (assoc state ::value (atom (first (:rum/args state)))))} - [state _default-value {:keys [min max on-change]}] + [state _default-value {max' :max :keys [min on-change]}] (let [*value (::value state) value (rum/react *value) value' (int value)] @@ -942,7 +942,7 @@ {:type "range" :value value' :min min - :max max + :max max' :style {:width "100%"} :on-change #(let [value (util/evalue %)] (reset! *value value)) @@ -962,7 +962,7 @@ (def icon shui.icon.v2/root) (rum/defc button-inner - [text & {:keys [theme background variant href size class intent small? icon icon-props disabled? button-props] + [text & {icon' :icon :keys [theme background variant href size class intent small? icon-props disabled? button-props] :or {small? false} :as opts}] (let [button-props (merge @@ -977,20 +977,20 @@ :else (or variant :default)) :href href :size (if small? :xs (or size :sm)) - :icon icon + :icon icon' :class (if (and (string? background) (not (contains? #{"gray" "red"} background))) (str class " primary-" background) class) :muted disabled?} button-props) - icon (when icon (shui/tabler-icon icon icon-props)) + icon'' (when icon' (shui/tabler-icon icon' icon-props)) href? (not (string/blank? href)) text (cond href? [:a {:href href :target "_blank" :style {:color "inherit"}} text] :else text) - children [icon text]] + children [icon'' text]] (shui/button props children))) diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index c69a6bf74..d7d3fd7ac 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -262,8 +262,8 @@ ;; ".lg:absolute.lg:inset-y-0.lg:right-0.lg:w-1/2" (defn hiccup->class - [class] - (some->> (string/split class #"\.") + [class'] + (some->> (string/split class' #"\.") (string/join " ") (string/trim))) @@ -345,7 +345,7 @@ (when-not node-test? (extend-type js/NodeList ISeqable - (-seq [array] (array-seq array 0))))) + (-seq [arr] (array-seq arr 0))))) ;; Caret #?(:cljs @@ -545,9 +545,9 @@ (defn bottom-reached? [node threshold] (let [full-height (gobj/get node "scrollHeight") - scroll-top (gobj/get node "scrollTop") + scroll-top' (gobj/get node "scrollTop") client-height (gobj/get node "clientHeight")] - (<= (- full-height scroll-top client-height) threshold)))) + (<= (- full-height scroll-top' client-height) threshold)))) #?(:cljs (defn link? @@ -1256,7 +1256,7 @@ .-clientHeight) main-node (app-scroll-container-node el) - scroll-top (.-scrollTop main-node) + scroll-top' (.-scrollTop main-node) current-pos (get-selection-start el) grapheme-pos (get-graphemes-pos (.-value (.textContent el)) current-pos) @@ -1274,7 +1274,7 @@ scroll (- cursor-y (- vw-height (+ @keyboard-height (+ 40 4))))] (cond (and to-vw-one-quarter? (> cursor-y (* vw-height 0.4))) - (set! (.-scrollTop main-node) (+ scroll-top (- cursor-y (/ vw-height 4)))) + (set! (.-scrollTop main-node) (+ scroll-top' (- cursor-y (/ vw-height 4)))) (and (< cursor-y (+ header-height offset-height 4)) ;; 4 is top+bottom padding for per line (>= cursor-y header-height)) @@ -1283,11 +1283,11 @@ (< cursor-y header-height) (let [_ (.scrollIntoView el true) main-node (app-scroll-container-node el) - scroll-top (.-scrollTop main-node)] - (set! (.-scrollTop main-node) (- scroll-top (/ vw-height 4)))) + scroll-top' (.-scrollTop main-node)] + (set! (.-scrollTop main-node) (- scroll-top' (/ vw-height 4)))) (> scroll 0) - (set! (.-scrollTop main-node) (+ scroll-top scroll)) + (set! (.-scrollTop main-node) (+ scroll-top' scroll)) :else nil))))) diff --git a/src/main/frontend/util/clock.cljs b/src/main/frontend/util/clock.cljs index 1fb39b879..3ff018b83 100644 --- a/src/main/frontend/util/clock.cljs +++ b/src/main/frontend/util/clock.cljs @@ -93,7 +93,7 @@ content))) (defn clock-summary - [body string?] + [body string?'] (when-let [logbook (drawer/get-logbook body)] (when-let [logbook-lines (last logbook)] (when-let [clock-lines (seq (filter #(string/starts-with? % "CLOCK:") logbook-lines))] @@ -105,7 +105,7 @@ :seconds seconds) duration-in-minutes (t/in-minutes duration) zero-minutes? (zero? duration-in-minutes)] - (if string? + (if string?' (if zero-minutes? (str seconds "s") (-> (tf/unparse-duration duration) diff --git a/src/main/frontend/util/cursor.cljs b/src/main/frontend/util/cursor.cljs index a9aa684ec..0ec7b240c 100644 --- a/src/main/frontend/util/cursor.cljs +++ b/src/main/frontend/util/cursor.cljs @@ -65,34 +65,34 @@ (defn move-cursor-to ([input n] (move-cursor-to input n false)) - ([input n delay?] + ([input n delay?'] (.setSelectionRange input n n) (when-not (= js/document.activeElement input) (let [focus #(.focus input)] - (if delay? (js/setTimeout focus 16) (focus)))))) + (if delay?' (js/setTimeout focus 16) (focus)))))) (defn move-cursor-forward ([input] (move-cursor-forward input 1)) ([input n] (when input - (let [{:keys [pos]} (get-caret-pos input) - pos (if (= n 1) - (or (util/safe-inc-current-pos-from-start (.-value input) pos) - (inc pos)) - (+ pos n))] - (move-cursor-to input pos))))) + (let [{pos' :pos} (get-caret-pos input) + pos'' (if (= n 1) + (or (util/safe-inc-current-pos-from-start (.-value input) pos') + (inc pos')) + (+ pos' n))] + (move-cursor-to input pos''))))) (defn move-cursor-backward ([input] (move-cursor-backward input 1)) ([input n] (when input - (let [{:keys [pos]} (get-caret-pos input) - pos (if (= n 1) - (util/safe-dec-current-pos-from-end (.-value input) pos) - (- pos n))] - (move-cursor-to input pos))))) + (let [{pos' :pos} (get-caret-pos input) + pos'' (if (= n 1) + (util/safe-dec-current-pos-from-end (.-value input) pos') + (- pos' n))] + (move-cursor-to input pos''))))) (defn- get-input-content&pos [input] @@ -101,24 +101,24 @@ (defn line-beginning-pos [input] - (let [[content pos] (get-input-content&pos input)] - (if (zero? pos) 0 - (let [last-newline-pos (string/last-index-of content \newline (dec pos))] + (let [[content pos'] (get-input-content&pos input)] + (if (zero? pos') 0 + (let [last-newline-pos (string/last-index-of content \newline (dec pos'))] (if (= nil last-newline-pos) 0 ;; no newline found (first line) (inc last-newline-pos)))))) (defn line-end-pos [input] - (let [[content pos] (get-input-content&pos input)] - (or (string/index-of content \newline pos) + (let [[content pos'] (get-input-content&pos input)] + (or (string/index-of content \newline pos') (count content)))) (defn beginning-of-line? [input] - (let [[content pos] (get-input-content&pos input)] + (let [[content pos'] (get-input-content&pos input)] (when content - (or (zero? pos) - (when-let [pre-char (subs content (dec pos) pos)] + (or (zero? pos') + (when-let [pre-char (subs content (dec pos') pos')] (= pre-char \newline)))))) (defn move-cursor-to-line-end @@ -131,16 +131,16 @@ (defn move-cursor-to-end [input] - (let [pos (count (gobj/get input "value"))] - (move-cursor-to input pos))) + (let [pos' (count (gobj/get input "value"))] + (move-cursor-to input pos'))) (defn move-cursor-to-thing ([input thing] (move-cursor-to-thing input thing (pos input))) ([input thing from] (let [[content _pos] (get-input-content&pos input) - pos (string/index-of content thing from)] - (move-cursor-to input pos)))) + pos' (string/index-of content thing from)] + (move-cursor-to input pos')))) (defn move-cursor-forward-by-word [input] @@ -208,26 +208,26 @@ (let [elms (-> (gdom/getElement "mock-text") gdom/getChildren array-seq) - chars (->> elms + chars' (->> elms (map mock-char-pos) (group-by :top)) - tops (sort (keys chars)) + tops (sort (keys chars')) tops-p (partition-by #(== (:top cursor) %) tops) line-next (if (= :up direction) (-> tops-p first last) (-> tops-p last first)) lefts - (->> (get chars line-next) + (->> (get chars' line-next) (partition-by (fn [char-pos] (<= (:left char-pos) (:left cursor))))) left-a (-> lefts first last) left-c (-> lefts last first) - closer + closer' (if (> 2 (count lefts)) left-a (closer left-a cursor left-c))] - (:pos closer))) + (:pos closer'))) (defn- move-cursor-up-down [input direction] diff --git a/src/main/frontend/worker/db/migrate.cljs b/src/main/frontend/worker/db/migrate.cljs index a1670f3bf..0c7c1ae3d 100644 --- a/src/main/frontend/worker/db/migrate.cljs +++ b/src/main/frontend/worker/db/migrate.cljs @@ -276,8 +276,8 @@ (#(sqlite-create-graph/build-initial-classes* % {})) (map (fn [b] (assoc b :logseq.property/built-in? true)))) fixes (mapcat - (fn [update] - (when-let [fix (:fix update)] + (fn [update'] + (when-let [fix (:fix update')] (when (fn? fix) (fix conn search-db)))) updates) tx-data' (if db-based? (concat new-properties new-classes fixes) fixes)] diff --git a/src/main/frontend/worker/db_worker.cljs b/src/main/frontend/worker/db_worker.cljs index 190655827..cf6f66aec 100644 --- a/src/main/frontend/worker/db_worker.cljs +++ b/src/main/frontend/worker/db_worker.cljs @@ -282,10 +282,10 @@ (db-listener/listen-db-changes! repo conn))))) -(defn- iter->vec [iter] - (when iter +(defn- iter->vec [iter'] + (when iter' (p/loop [acc []] - (p/let [elem (.next iter)] + (p/let [elem (.next iter')] (if (.-done elem) acc (p/recur (conj acc (.-value elem)))))))) diff --git a/src/main/frontend/worker/rtc/core.cljs b/src/main/frontend/worker/rtc/core.cljs index 24535129d..f42503803 100644 --- a/src/main/frontend/worker/rtc/core.cljs +++ b/src/main/frontend/worker/rtc/core.cljs @@ -313,10 +313,10 @@ (def ^:private create-get-state-flow (let [rtc-loop-metadata-flow (m/watch *rtc-loop-metadata)] (m/ap - (let [{:keys [repo graph-uuid user-uuid rtc-state-flow *rtc-auto-push? *rtc-lock *online-users]} + (let [{rtc-lock :*rtc-lock :keys [repo graph-uuid user-uuid rtc-state-flow *rtc-auto-push? *online-users]} (m/?< rtc-loop-metadata-flow)] (try - (when (and repo rtc-state-flow *rtc-auto-push? *rtc-lock) + (when (and repo rtc-state-flow *rtc-auto-push? rtc-lock) (m/?< (m/latest (fn [rtc-state rtc-auto-push? rtc-lock online-users pending-local-ops-count local-tx remote-tx] @@ -329,7 +329,7 @@ :rtc-lock rtc-lock :auto-push? rtc-auto-push? :online-users online-users}) - rtc-state-flow (m/watch *rtc-auto-push?) (m/watch *rtc-lock) (m/watch *online-users) + rtc-state-flow (m/watch *rtc-auto-push?) (m/watch rtc-lock) (m/watch *online-users) (client-op/create-pending-ops-count-flow repo) (rtc-log-and-state/create-local-t-flow graph-uuid) (rtc-log-and-state/create-remote-t-flow graph-uuid)))) diff --git a/src/main/frontend/worker/search.cljs b/src/main/frontend/worker/search.cljs index 15d6642b1..8dd5eb330 100644 --- a/src/main/frontend/worker/search.cljs +++ b/src/main/frontend/worker/search.cljs @@ -167,8 +167,8 @@ DROP TRIGGER IF EXISTS blocks_au; (when (and (string? q) (string? match)) (boolean (reduce - (fn [coll char] - (let [coll' (drop-while #(not= char %) coll)] + (fn [coll char'] + (let [coll' (drop-while #(not= char' %) coll)] (if (seq coll') (rest coll') (reduced false)))) diff --git a/src/main/logseq/api.cljs b/src/main/logseq/api.cljs index 7de21ac4c..2e4e28556 100644 --- a/src/main/logseq/api.cljs +++ b/src/main/logseq/api.cljs @@ -1174,8 +1174,8 @@ ;; search (defn ^:export search - [q] - (-> (search-handler/search q) + [q'] + (-> (search-handler/search q') (p/then #(bean/->js %)))) ;; helpers diff --git a/src/test/frontend/modules/outliner/core_test.cljs b/src/test/frontend/modules/outliner/core_test.cljs index 3912b3794..7ae120eeb 100644 --- a/src/test/frontend/modules/outliner/core_test.cljs +++ b/src/test/frontend/modules/outliner/core_test.cljs @@ -436,8 +436,8 @@ (deftest test-batch-transact (testing "add 4, 5 after 2 and delete 3" - (let [tree [[10 [[2] [3]]]]] - (transact-tree! tree) + (let [tree' [[10 [[2] [3]]]]] + (transact-tree! tree') (let [new-blocks (build-blocks [[4 [5]]]) target-block (get-block 2)] (outliner-tx/transact! @@ -585,9 +585,9 @@ tags:: tag1, tag2 (defn gen-blocks [] - (let [tree (gen-safe-tree)] - (if (seq tree) - (let [result (build-blocks tree)] + (let [tree' (gen-safe-tree)] + (if (seq tree') + (let [result (build-blocks tree')] (if (seq result) result (gen-blocks))) @@ -606,9 +606,9 @@ tags:: tag1, tag2 (defn transact-random-tree! [] - (let [tree (gen-safe-tree)] - (if (seq tree) - (transact-tree! tree) + (let [tree' (gen-safe-tree)] + (if (seq tree') + (transact-tree! tree') (transact-random-tree!)))) (defn get-datoms diff --git a/src/test/frontend/test/helper.cljs b/src/test/frontend/test/helper.cljs index 562690acf..af3bc7fac 100644 --- a/src/test/frontend/test/helper.cljs +++ b/src/test/frontend/test/helper.cljs @@ -29,16 +29,16 @@ (defn start-test-db! [& {:as opts}] (let [db-graph? (or (:db-graph? opts) (and node? (some? js/process.env.DB_GRAPH))) - test-db (if db-graph? test-db-name-db-version test-db-name)] - (state/set-current-repo! test-db) - (conn/start! test-db opts) - (let [conn (conn/get-db test-db false)] + test-db' (if db-graph? test-db-name-db-version test-db-name)] + (state/set-current-repo! test-db') + (conn/start! test-db' opts) + (let [conn (conn/get-db test-db' false)] (when db-graph? (db-pipeline/add-listener conn) (d/transact! conn (sqlite-create-graph/build-db-initial-data ""))) (d/listen! conn ::listen-db-changes! (fn [tx-report] - (worker-pipeline/invoke-hooks test-db conn tx-report {})))))) + (worker-pipeline/invoke-hooks test-db' conn tx-report {})))))) (defn destroy-test-db! [] diff --git a/src/test/frontend/worker/undo_redo_test.cljs b/src/test/frontend/worker/undo_redo_test.cljs index d086bdf00..e28cf6385 100644 --- a/src/test/frontend/worker/undo_redo_test.cljs +++ b/src/test/frontend/worker/undo_redo_test.cljs @@ -141,10 +141,10 @@ nil)) (defn- undo-all - [conn page-uuid] + [conn page-uuid'] (binding [undo-redo/*undo-redo-info-for-test* (atom nil)] (loop [i 0] - (let [r (undo-redo/undo test-helper/test-db-name-db-version page-uuid conn) + (let [r (undo-redo/undo test-helper/test-db-name-db-version page-uuid' conn) current-db @conn] (check-block-count @undo-redo/*undo-redo-info-for-test* current-db) (if (not= :frontend.worker.undo-redo/empty-undo-stack r) @@ -152,10 +152,10 @@ (prn :undo-count i)))))) (defn- redo-all - [conn page-uuid] + [conn page-uuid'] (binding [undo-redo/*undo-redo-info-for-test* (atom nil)] (loop [i 0] - (let [r (undo-redo/redo test-helper/test-db-name-db-version page-uuid conn) + (let [r (undo-redo/redo test-helper/test-db-name-db-version page-uuid' conn) current-db @conn] (check-block-count @undo-redo/*undo-redo-info-for-test* current-db) (if (not= :frontend.worker.undo-redo/empty-redo-stack r) @@ -203,19 +203,19 @@ (is (= origin-graph-block-set (get-db-block-set @conn))))))) (defn- print-page-stat - [db page-uuid] - (let [page (d/entity db [:block/uuid page-uuid]) + [db page-uuid'] + (let [page (d/entity db [:block/uuid page-uuid']) blocks (ldb/get-page-blocks db (:db/id page))] (pp/pprint {:block-count (count blocks) :undo-op-count (count (get-in @(:undo/repo->page-block-uuid->undo-ops @worker-state/*state) - [test-helper/test-db-name-db-version page-uuid])) + [test-helper/test-db-name-db-version page-uuid'])) :redo-op-count (count (get-in @(:undo/repo->page-block-uuid->redo-ops @worker-state/*state) - [test-helper/test-db-name-db-version page-uuid]))}))) + [test-helper/test-db-name-db-version page-uuid']))}))) (defn- print-page-blocks-tree - [db page-uuid] - (let [page (d/entity db [:block/uuid page-uuid]) + [db page-uuid'] + (let [page (d/entity db [:block/uuid page-uuid']) blocks (ldb/get-page-blocks db (:db/id page))] (prn ::page-block-tree) (pp/pprint @@ -227,7 +227,7 @@ (assoc :block/children (:block/children x))) x)) (otree/blocks->vec-tree test-helper/test-db-name-db-version db - blocks page-uuid))))) + blocks page-uuid'))))) (deftest ^:long ^:wip undo-redo-outliner-op-gen-test (try