From 58938dbd4fda28999acdd09ff52d792c28ec084a Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 31 Jul 2026 13:58:52 +0100 Subject: [PATCH] Fix another layout loop. --- .../Navigation/NavigationTabCoordinator.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift b/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift index 67192d6a8..0644f7c19 100644 --- a/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift +++ b/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift @@ -315,6 +315,7 @@ private struct NavigationTabCoordinatorView: View { @State private var standardAppearance = UITabBarAppearance() @State private var window: UIWindow? @State private var isFullScreen = true + @State private var isRailVisible = true var body: some View { tabView @@ -357,10 +358,6 @@ private struct NavigationTabCoordinatorView: View { return selectedTabDetails?.navigationSplitCoordinator?.columnVisibility ?? .all } - private var isRailVisible: Bool { - selectedTabSplitColumnVisibility != .detailOnly - } - var tabRailLayout: some View { HStack(spacing: 0) { if isRailVisible { @@ -389,6 +386,14 @@ private struct NavigationTabCoordinatorView: View { isFullScreen = newValue } } + .onChange(of: selectedTabSplitColumnVisibility, initial: true) { + // The rail consumes width, which feeds back into the split's column visibility (not the + // same as flattening everything into the single stack), creating an observation tracking + // feedback loop that locks up the app while resizing. + // + // Use a stored value (instead of a computed value) that is updated on the next run loop to break the loop. + DispatchQueue.main.async { isRailVisible = selectedTabSplitColumnVisibility != .detailOnly } + } } var tabViewLayout: some View {