Skip to content

Commit 57fcd59

Browse files
committed
fix: reset search stack
1 parent cbb7556 commit 57fcd59

7 files changed

Lines changed: 36 additions & 35 deletions

File tree

ios/App/App/AppDelegate.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
406406
let path = self.normalizedPath(rawPath)
407407
let navigationType = (notification.userInfo?["navigationType"] as? String) ?? "push"
408408
let stackId = (notification.userInfo?["stack"] as? String) ?? "home"
409+
let previousStackId = self.activeStackId
409410

410411
#if DEBUG
411412
print("📡 routeDidChange from JS → native")
@@ -417,8 +418,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
417418
// 1️⃣ Stack switch: home ↔ capture ↔ goto ...
418419
// ============================================
419420
if stackId != self.activeStackId {
420-
// Save current native stack paths
421-
self.setPaths(self.pathStack, for: self.activeStackId)
421+
// Save current native stack paths; drop stale search stack when leaving it.
422+
if previousStackId == "search", stackId != "search" {
423+
self.setPaths(["/__stack__/search"], for: "search")
424+
} else {
425+
self.setPaths(self.pathStack, for: previousStackId)
426+
}
422427

423428
// Load (or create) new stack's paths
424429
var newPaths = self.paths(for: stackId)

src/main/frontend/components/quick_add.cljs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@
5858
"Quick add"]
5959
add-button])
6060
(if mobile?
61-
[:main#app-container-wrapper.ls-fold-button-on-right
62-
[:div#app-container.pt-2
63-
[:div#main-container.flex.flex-1
64-
[:div.w-full.mt-4
65-
(page-blocks add-page)]]]]
61+
[:div.w-full.mt-4
62+
(page-blocks add-page)]
6663
[:div.content {:class "block -ml-6"}
6764
(page-blocks add-page)])
6865
(when-not mobile? add-button)]))))

src/main/mobile/components/app.cljs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131
(rum/defc journals
3232
[]
33-
(ui-component/classic-app-container-wrap
34-
(journal/all-journals)))
33+
(journal/all-journals))
3534

3635
(rum/defc home-inner < rum/static
3736
[db-restoring?]
@@ -118,13 +117,13 @@
118117
;; - Journals layer keeps its own scroll container and is always in the DOM.
119118
;; - Page/other-tab layer keeps its own independent scroll container.
120119
;; Both are absolutely positioned and stacked; we toggle visibility.
121-
[:div.h-full.relative
122-
;; Journals scroll container (keep-alive)
120+
[:div.w-full.relative
121+
;; Journals scroll container (keep-alive)
123122
[:div#app-main-home.pl-3.pr-2.absolute.inset-0
124123
{:class (when-not home? "invisible pointer-events-none")}
125124
(home)]
126125

127-
;; Other pages: search, settings, specific page, etc.
126+
;; Other pages: search, settings, specific page, etc.
128127
(when-not home?
129128
(other-page view tab route-match))]))
130129

@@ -141,7 +140,7 @@
141140
(when-let [element (util/app-scroll-container-node)]
142141
(common-handler/listen-to-scroll! element)))
143142
[])
144-
[:div.h-full
143+
[:<>
145144
(mobile-header/header current-repo tab)
146145
(main-content tab route-match)]))
147146

@@ -156,13 +155,11 @@
156155
show-action-bar? (state/sub :mobile/show-action-bar?)
157156
{:keys [open? content-fn opts]} (rum/react mobile-state/*popup-data)
158157
show-popup? (and open? content-fn)
159-
fold-button-on-right? (state/enable-fold-button-right?)
160158
route-match (state/sub :route-match)]
161-
[:div#app-main.w-full.h-full
162-
{:class (util/classnames
163-
[{:ls-fold-button-on-right fold-button-on-right?}])}
164-
[:div.w-full.h-full {:class (when show-popup? "invisible")}
165-
(app current-repo route-match)]
159+
[:main#app-container-wrapper.ls-fold-button-on-right
160+
[:div#app-container {:class (when show-popup? "invisible")}
161+
[:div#main-container.flex.flex-1.overflow-x-hidden.py-4
162+
(app current-repo route-match)]]
166163
(when show-popup?
167164
[:div.ls-layer
168165
(popup/popup opts content-fn)])

src/main/mobile/components/app.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ html.is-ios {
1414
font-size: calc(var(--ls-mobile-font-size) * var(--ls-mobile-font-scale, 1));
1515
}
1616

17-
#app-main {
17+
#app-container-wrapper, #app-container, #main-container {
18+
@apply w-full h-full;
19+
}
20+
21+
#app-container-wrapper {
1822
padding-top: env(safe-area-inset-top);
1923
padding-bottom: env(safe-area-inset-bottom);
2024
}

src/main/mobile/components/ui.cljs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
(defonce transition-group (r/adapt-class TransitionGroup))
1212
(defonce css-transition (r/adapt-class CSSTransition))
1313

14-
(rum/defc classic-app-container-wrap
15-
[content]
16-
[:main#app-container-wrapper.ls-fold-button-on-right
17-
[:div#app-container.pt-2
18-
[:div#main-container.flex.flex-1.overflow-x-hidden
19-
[:div.w-full content]]]])
20-
2114
(rum/defc notification-clear-all
2215
[]
2316
[:div.ui__notifications-content

src/main/mobile/routes.cljs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
["/export"
2020
{:name :export
2121
:view (fn []
22-
[:div.mt-8
23-
(export/export)])}]])
22+
(export/export))}]])

src/main/mobile/state.cljs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44
[frontend.state :as state]
55
[mobile.navigation :as mobile-nav]))
66

7-
(defonce *tab (atom "home"))
8-
(defn set-tab! [tab]
9-
(reset! *tab tab)
10-
(when tab
11-
(mobile-nav/switch-stack! tab)))
12-
(defn use-tab [] (r/use-atom *tab))
137
(defonce *search-input (atom ""))
148
(defn use-search-input []
159
(r/use-atom *search-input))
1610
(defonce *search-last-input-at (atom nil))
1711
(defn use-search-last-input-at []
1812
(r/use-atom *search-last-input-at))
1913

14+
(defonce *tab (atom "home"))
15+
(defn set-tab! [tab]
16+
(let [prev @*tab]
17+
;; When leaving the search tab, clear its stack so reopening starts fresh.
18+
(when (and (= prev "search")
19+
(not= tab "search"))
20+
(reset! *search-input "")
21+
(mobile-nav/reset-stack-history! "search"))
22+
(reset! *tab tab)
23+
(mobile-nav/switch-stack! tab)))
24+
(defn use-tab [] (r/use-atom *tab))
25+
2026
(defonce *popup-data (atom nil))
2127
(defn set-popup!
2228
[data]

0 commit comments

Comments
 (0)