Browse Source

fix: page blink when inserting new block when zoom-in a block

Tienson Qin 2 months ago
parent
commit
8f29bc17db
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/main/frontend/components/block.cljs

+ 6 - 2
src/main/frontend/components/block.cljs

@@ -4390,9 +4390,13 @@
 (rum/defc block-list
   [config blocks]
   (let [[virtualized? _] (rum/use-state (not (or (string/includes? js/window.location.search "?rtc-test=true")
-                                                 (and (:journals? config) (< (count blocks) 50))
+                                                 (if (:journals? config)
+                                                   (< (count blocks) 50)
+                                                   (< (count blocks) 10))
                                                  (and (util/mobile?) (ldb/journal? (:block/page (first blocks))))
-                                                 (:block-children? config))))
+                                                 (and (:block-children? config)
+                                                      ;; zoom-in block's children
+                                                      (not (and (:id config) (= (:id config) (str (:block/uuid (:block/parent (first blocks)))))))))))
         render-item (fn [idx]
                       (let [top? (zero? idx)
                             bottom? (= (dec (count blocks)) idx)