Fix active profile flickering on first launch

Move .onAppear() handler to main view.
This commit is contained in:
Davide De Rosa 2022-05-01 20:07:51 +02:00
parent 3571c7db35
commit 472b5e4b41
1 changed files with 2 additions and 9 deletions

View File

@ -125,6 +125,8 @@ struct OrganizerView: View {
return ZStack {
hiddenSceneView
mainView
.onAppear(perform: presentActiveProfile)
if !profileManager.hasProfiles {
emptyView
}
@ -207,8 +209,6 @@ struct OrganizerView: View {
profileLabel(forHeader: header)
}.contextMenu {
profileMenu(forHeader: header)
}.onAppear {
presentIfActiveProfile(header.id)
}
}
@ -338,13 +338,6 @@ extension OrganizerView {
}
extension OrganizerView {
private func presentIfActiveProfile(_ id: UUID) {
guard id == profileManager.activeHeader?.id else {
return
}
presentActiveProfile()
}
private func presentActiveProfile() {
guard isFirstLaunch else {
return