Skip to content

Commit

Permalink
perf: reduce str & pr-str calls
Browse files Browse the repository at this point in the history
  • Loading branch information
RCmerci committed Dec 12, 2024
1 parent 1bd5028 commit ebbb53c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/frontend/components/property/value.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@
state)}
[state value block property page-cp]
(when value
(if (state/sub-async-query-loading value)
(if (state/sub-async-query-loading (:block/uuid value))
[:div.text-sm.opacity-70 "loading"]
(if-let [v-block (db/sub-block (:db/id value))]
(let [class? (ldb/class? v-block)
Expand Down
9 changes: 5 additions & 4 deletions src/main/frontend/state.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2286,10 +2286,11 @@ Similar to re-frame subscriptions"

(defn sub-async-query-loading
[k]
(assert (some? k))
(rum/react
(r/cached-derived-atom (:db/async-query-loading @state) [(get-current-repo) ::async-query (str k)]
(fn [s] (contains? s (str k))))))
(assert (or (string? k) (uuid? k)))
(let [k* (str k)]
(rum/react
(r/cached-derived-atom (:db/async-query-loading @state) [(get-current-repo) ::async-query k*]
(fn [s] (contains? s k*))))))

(defn clear-async-query-state!
[]
Expand Down

0 comments on commit ebbb53c

Please sign in to comment.