From b28cd247ced739be643e8dd73640de12049b7c6f Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 19 May 2026 03:47:04 +0800 Subject: [PATCH] fix: route mobile search results through home stack --- ios/App/App/AppDelegate.swift | 9 +++++++-- src/main/mobile/bottom_tabs.cljs | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift index 63ceb3bc7d..548e404cf3 100644 --- a/ios/App/App/AppDelegate.swift +++ b/ios/App/App/AppDelegate.swift @@ -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 diff --git a/src/main/mobile/bottom_tabs.cljs b/src/main/mobile/bottom_tabs.cljs index 6b4cc9432b..7342b37dcd 100644 --- a/src/main/mobile/bottom_tabs.cljs +++ b/src/main/mobile/bottom_tabs.cljs @@ -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!