From 44dfda8d336e8cca76ebc913614a432bee71636c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Wed, 26 Nov 2025 15:40:39 -0800 Subject: [PATCH] Fix AttributeGraph cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://github.com/damus-io/damus/issues/3342 Changelog-Fixed: Fixed an issue where the mute list view may occasionally freeze the app Signed-off-by: Daniel D’Aquino --- damus/Features/Muting/Views/MutelistView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/damus/Features/Muting/Views/MutelistView.swift b/damus/Features/Muting/Views/MutelistView.swift index d152dd0c..bb0a29df 100644 --- a/damus/Features/Muting/Views/MutelistView.swift +++ b/damus/Features/Muting/Views/MutelistView.swift @@ -17,6 +17,8 @@ struct MutelistView: View { @State var words: [MuteItem] = [] @State var new_text: String = "" + + @State var paddingBottom: CGFloat = 30 func RemoveAction(item: MuteItem) -> some View { Button { @@ -91,7 +93,7 @@ struct MutelistView: View { } Section( header: Text(NSLocalizedString("Users", comment: "Section header title for a list of muted users.")), - footer: Text("").padding(.bottom, 10 + tabHeight + getSafeAreaBottom()) + footer: VStack { EmptyView() }.padding(.bottom, paddingBottom) ) { ForEach(users, id: \.self) { user in if case let MuteItem.user(pubkey, _) = user { @@ -110,6 +112,9 @@ struct MutelistView: View { .navigationTitle(NSLocalizedString("Muted", comment: "Navigation title of view to see list of muted users & phrases.")) .onAppear { updateMuteItems() + // Note: Do not place this calculation on the view body, otherwise AttributeGraph cycles may occur, freezing the entire app + // FUTURE FIXME: The way the floating tab bar layout was setup feels a bit hacky. Can't we make that work without introspecting sizes of objects and manually computing layout numbers? + paddingBottom = 10 + tabHeight + getSafeAreaBottom() } .onReceive(handle_notify(.new_mutes)) { new_mutes in updateMuteItems()