From 0bdb02fdf49ce330be1e6a1989ea4ad23ad2c9bb Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 14 May 2024 08:16:02 +0800 Subject: [PATCH] perf: add lazy support for block list --- src/main/frontend/components/block.cljs | 34 ++++++++++--------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index abf98ce71..e090cfa59 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -3439,26 +3439,20 @@ (let [top? (zero? idx) bottom? (= (count blocks) (inc idx))] (rum/with-key - (block-item (assoc config :top? top?) - item - {:top? top? - :idx idx - :bottom? bottom?}) - (str "blocks-" (:block/uuid item))) - ;; (ui/lazy-visible - ;; (fn [] - ;; (rum/with-key - ;; (block-item (assoc config :top? top?) - ;; item - ;; {:top? top? - ;; :idx idx - ;; :bottom? bottom?}) - ;; (str "blocks-" (:block/uuid item)))) - ;; {:trigger-once? false - ;; :fade-in? false - ;; :initial-state false - ;; :debug-id (str (:db/id item) "-" (:block/content item))}) - ))) + (ui/lazy-visible + (fn [] + (rum/with-key + (block-item (assoc config :top? top?) + item + {:top? top? + :idx idx + :bottom? bottom?}) + (str "blocks-" (:block/uuid item)))) + {:trigger-once? true + :fade-in? false + :initial-state false + :debug-id (str (:db/id item) "-" (:block/content item))}) + (str (:container-id config) "-" (:db/id item)))))) (rum/defcs blocks-container < rum/static {:init (fn [state]