mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
refactor: replace rum/use-memo
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
[clojure.string :as string]
|
||||
[frontend.context.i18n :refer [t]]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.hooks :as hooks]
|
||||
[frontend.modules.shortcut.config :as shortcut-config]
|
||||
[frontend.modules.shortcut.core :as shortcut]
|
||||
[frontend.modules.shortcut.data-helper :as dh]
|
||||
@@ -212,7 +213,7 @@
|
||||
[current-binding set-current-binding!] (rum/use-state (or user-binding binding))
|
||||
[key-conflicts set-key-conflicts!] (rum/use-state nil)
|
||||
|
||||
handler-id (rum/use-memo #(dh/get-group k))
|
||||
handler-id (hooks/use-memo #(dh/get-group k))
|
||||
dirty? (not= (or user-binding binding) current-binding)
|
||||
keypressed? (not= "" keystroke)
|
||||
save-keystroke-fn!
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
[frontend.extensions.lightbox :as lightbox]
|
||||
[frontend.extensions.video.youtube :as youtube]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.hooks :as hooks]
|
||||
[frontend.modules.shortcut.config :as shortcut-config]
|
||||
[frontend.rum :as r]
|
||||
[frontend.search :as search]
|
||||
@@ -532,7 +533,7 @@
|
||||
(set-active-pane-state! next-state))
|
||||
|
||||
[scrolled?, set-scrolled!] (rum/use-state false)
|
||||
on-scroll (rum/use-memo #(util/debounce (fn [^js e] (set-scrolled! (not (< (.. e -target -scrollTop) 10)))) 100) [])]
|
||||
on-scroll (hooks/use-memo #(util/debounce 100 (fn [^js e] (set-scrolled! (not (< (.. e -target -scrollTop) 10))))))]
|
||||
|
||||
;; load handbooks
|
||||
(rum/use-effect!
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[rum.core :as rum]))
|
||||
|
||||
(defn- safe-dep
|
||||
"js/React use `js/Object.is` to compare dep-value and its previous value.
|
||||
"js/React uses `js/Object.is` to compare dep-value and its previous value.
|
||||
Some cljs built-in types(keyword, symbol, uuid) would not be identical, even they are value-equal"
|
||||
[dep]
|
||||
(if (contains? #{"string" "number" "boolean" "null"} (goog/typeOf dep))
|
||||
|
||||
Reference in New Issue
Block a user