fix: route mobile search results through home stack

This commit is contained in:
Tienson Qin
2026-05-19 03:47:04 +08:00
parent e6c3011ead
commit b28cd247ce
2 changed files with 12 additions and 2 deletions

View File

@@ -426,9 +426,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
return
}
// Fast-path: cancel search home root.
// Fast-path: cancel search -> home root.
if previousStackId == "search",
stackId == "home"{
stackId == "home",
path == self.rootPath(for: "home") {
self.setPaths(["/__stack__/search"], for: "search")
self.activeStackId = "home"
@@ -462,6 +463,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
} else if newPaths.isEmpty {
// First time visiting this stack
newPaths = [path]
} else if navigationType == "push",
let last = newPaths.last,
last != path {
newPaths.append(path)
} else if let last = newPaths.last, last != path {
// Same history, but different top path align the top.
newPaths[newPaths.count - 1] = path

View File

@@ -82,6 +82,11 @@
(fn [data]
(when-let [id (.-id data)]
(when-not (string/blank? id)
(when (= "search" @mobile-state/*tab)
(reset! mobile-state/*search-input "")
(mobile-nav/reset-stack-history! "search")
(reset! mobile-state/*tab "home")
(mobile-nav/set-current-stack! "home"))
(route-handler/redirect-to-page! id {:push (mobile-util/native-platform?)})))))))
(defn add-keyboard-hack-listener!