fix: wrong routes when navigating back from table row

This commit is contained in:
Tienson Qin
2025-11-30 11:48:32 +08:00
parent 7c154f2e03
commit 073e46d8d6
2 changed files with 11 additions and 5 deletions

View File

@@ -241,7 +241,7 @@
(state/exit-editing-and-set-selected-blocks! [cell])
(set-focus-timeout! (js/setTimeout #(.focus cell) 100)))))
(rum/defc ^:large-vars/cleanup-todo block-title
(rum/defc ^:large-vars/cleanup-todo block-title < rum/static
"Used on table view"
[block* {:keys [create-new-block width row property]}]
(let [*ref (hooks/use-ref nil)

View File

@@ -20,13 +20,19 @@
[logseq.shui.ui :as shui]
[reitit.frontend.easy :as rfe]))
(defonce *previous-route (atom nil))
(defn redirect!
"If `push` is truthy, previous page will be left in history."
[{:keys [to path-params query-params push]
:or {push true}}]
(shui/popup-hide!)
(let [route-fn (if push rfe/push-state rfe/replace-state)]
(route-fn to path-params query-params))
:or {push true}
:as route}]
;; avoid repeat routes
(when-not (= route @*previous-route)
(reset! *previous-route route)
(shui/popup-hide!)
(let [route-fn (if push rfe/push-state rfe/replace-state)]
(route-fn to path-params query-params)))
;; force return nil for usage in render phase of React
nil)