From 046bc8c06bc388d19a77c7674edfdaca22f1d21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 10 Jun 2024 00:03:36 +0800 Subject: [PATCH] Fix profile list sync // it works, but why? --- ApplicationLibrary/Views/Profile/ProfileView.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ApplicationLibrary/Views/Profile/ProfileView.swift b/ApplicationLibrary/Views/Profile/ProfileView.swift index 2799a00..2b3b0b1 100644 --- a/ApplicationLibrary/Views/Profile/ProfileView.swift +++ b/ApplicationLibrary/Views/Profile/ProfileView.swift @@ -125,12 +125,9 @@ public struct ProfileView: View { } } .onReceive(environments.profileUpdate) { _ in - profileList = [] - isLoading = true -// not updated, but why? -// Task { -// await doReload() -// } + Task { + await doReload() + } } #if os(iOS) .toolbar { @@ -232,7 +229,7 @@ public struct ProfileView: View { alert = Alert(error) return } - await doReload() + environments.profileUpdate.send() } private func moveProfile(from source: IndexSet, to destination: Int) { @@ -247,6 +244,7 @@ public struct ProfileView: View { } catch { alert = Alert(error) } + environments.profileUpdate.send() } } @@ -262,6 +260,7 @@ public struct ProfileView: View { } catch { alert = Alert(error) } + environments.profileUpdate.send() } }