fix: address config settings viewbuilder updates

This commit is contained in:
Peter Steinberger
2026-01-21 01:23:37 +00:00
parent 23f7dd8b25
commit b333c4a994

View File

@@ -27,8 +27,8 @@ struct ConfigSettings: View {
await self.store.loadConfig() await self.store.loadConfig()
} }
.onAppear { self.ensureSelection() } .onAppear { self.ensureSelection() }
.onChange(of: self.store.configSchema) { _, _ in .onChange(of: self.store.configSchemaLoading) { _, loading in
self.ensureSelection() if !loading { self.ensureSelection() }
} }
} }
} }
@@ -215,25 +215,28 @@ extension ConfigSettings {
@ViewBuilder @ViewBuilder
private func subsectionNav(_ section: ConfigSection) -> some View { private func subsectionNav(_ section: ConfigSection) -> some View {
let subsections = self.resolveSubsections(for: section) let subsections = self.resolveSubsections(for: section)
guard !subsections.isEmpty else { return } if subsections.isEmpty {
ScrollView(.horizontal, showsIndicators: false) { EmptyView()
HStack(spacing: 8) { } else {
self.subsectionButton( ScrollView(.horizontal, showsIndicators: false) {
title: "All", HStack(spacing: 8) {
isSelected: self.activeSubsection == .all)
{
self.activeSubsection = .all
}
ForEach(subsections) { subsection in
self.subsectionButton( self.subsectionButton(
title: subsection.label, title: "All",
isSelected: self.activeSubsection == .key(subsection.key)) isSelected: self.activeSubsection == .all)
{ {
self.activeSubsection = .key(subsection.key) self.activeSubsection = .all
}
ForEach(subsections) { subsection in
self.subsectionButton(
title: subsection.label,
isSelected: self.activeSubsection == .key(subsection.key))
{
self.activeSubsection = .key(subsection.key)
}
} }
} }
.padding(.vertical, 2)
} }
.padding(.vertical, 2)
} }
} }