fix: mobile app crashes while trying to swipe the block that has any collapsed block (#9154)

pull/9181/head
situ2001 2023-04-20 14:18:04 +08:00 committed by GitHub
parent beb02b6028
commit 67fe5dc5a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -39,9 +39,12 @@
(when-let [block (state/sub :mobile/actioned-block)]
(let [{:block/keys [uuid children]} block
last-child-block-id (when-not (empty? children)
(-> (db/get-block-children (state/get-current-repo) uuid)
last
:block/uuid))]
(->> (db/get-block-children (state/get-current-repo) uuid)
(filter #(not (db/parents-collapsed? (state/get-current-repo) (:block/uuid %1)))) ;; DOM nodes of blocks the have collapsed parents have no bounding client rect
last
:block/uuid))]
;; scroll to the most bottom element of the selected block
(let [tag-id (or last-child-block-id uuid)
bottom-el (gdom/getElement (str "block-content-" tag-id))
bottom (gobj/get (.getBoundingClientRect bottom-el) "bottom")