fix(nav): resolve routing bug when target tab is hidden inside 'More' tab

- Fix an issue where navigating to Records via long-press stops at the 'More' tab menu
- Update navigation logic to automatically route through the 'More' tab and land directly on the target screen
- Ensure action filters are correctly applied when deep-linking to nested tabs
This commit is contained in:
songyc macbook 2026-07-09 04:45:37 +09:00
parent 5475590a47
commit acdddbb670
2 changed files with 21 additions and 7 deletions

View File

@ -90,11 +90,19 @@ final class AppRouter {
/// ( nil )
var pendingHistoryActionID: PersistentIdentifier?
/// . .
/// . .
var morePath: [AppTab] = []
/// . .
func openHistory(filtering actionID: PersistentIdentifier, visibleTabsRaw: String) {
pendingHistoryActionID = actionID
let visible = AppTab.visibleTabs(from: visibleTabsRaw)
tabSelection = visible.contains(.history) ? AppTab.history.rawValue : AppTab.moreTabValue
if visible.contains(.history) {
tabSelection = AppTab.history.rawValue
} else {
morePath = [.history]
tabSelection = AppTab.moreTabValue
}
}
}
@ -190,9 +198,12 @@ struct MainTabView: View {
}
.onAppear {
#if DEBUG
// : -startTab
// : -startTab
let valid = visibleTabs.map(\.rawValue) + [AppTab.moreTabValue]
if !valid.contains(router.tabSelection) {
if let hidden = AppTab(rawValue: router.tabSelection) {
router.morePath = [hidden]
}
router.tabSelection = AppTab.moreTabValue
}
#endif
@ -203,14 +214,14 @@ struct MainTabView: View {
// MARK: -
struct MoreTabView: View {
@Environment(AppRouter.self) private var router
let tabs: [AppTab]
var body: some View {
NavigationStack {
@Bindable var router = router
NavigationStack(path: $router.morePath) {
List(tabs) { tab in
NavigationLink {
tab.rootView
} label: {
NavigationLink(value: tab) {
Label {
Text(tab.label)
} icon: {
@ -222,6 +233,9 @@ struct MoreTabView: View {
.scrollContentBackground(.hidden)
.background(AppTheme.background)
.navigationTitle("더보기")
.navigationDestination(for: AppTab.self) { tab in
tab.rootView
}
}
}
}