mirror of
https://github.com/logseq/logseq.git
synced 2026-05-23 20:24:15 +00:00
fix: notify native route changes and then ui refresh
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
[]
|
||||
(.render root (app/main)))
|
||||
|
||||
(defonce ^:private *route-timeout (atom nil))
|
||||
(defn set-router!
|
||||
[]
|
||||
(let [router (rf/router routes nil)]
|
||||
@@ -36,14 +37,21 @@
|
||||
router
|
||||
(fn [route]
|
||||
(let [route-name (get-in route [:data :name])
|
||||
path (-> js/location .-hash (string/replace-first #"^#" ""))]
|
||||
path (-> js/location .-hash (string/replace-first #"^#" ""))
|
||||
pop? (= :pop @mobile-nav/navigation-source)
|
||||
timeout @*route-timeout]
|
||||
(when timeout
|
||||
(js/clearTimeout timeout))
|
||||
(mobile-nav/notify-route-change!
|
||||
{:route {:to route-name
|
||||
:path-params (:path-params route)
|
||||
:query-params (:query-params route)}
|
||||
:path path})
|
||||
|
||||
(route-handler/set-route-match! route)
|
||||
(if pop?
|
||||
(route-handler/set-route-match! route)
|
||||
(reset! *route-timeout
|
||||
(js/setTimeout #(route-handler/set-route-match! route) 200)))
|
||||
|
||||
(bottom-tabs/show!)
|
||||
(case route-name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[lambdaisland.glogi :as log]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defonce ^:private navigation-source (atom nil))
|
||||
(defonce navigation-source (atom nil))
|
||||
(defonce ^:private initialised? (atom false))
|
||||
|
||||
;; Track whether the latest change came from a native back gesture / popstate.
|
||||
|
||||
Reference in New Issue
Block a user