From 5c1ae9e9b1d0344d483070d5a41d03c32f092dd0 Mon Sep 17 00:00:00 2001 From: david-swift Date: Mon, 20 May 2024 11:38:36 +0200 Subject: [PATCH] Improve performance of entry rows --- Sources/Adwaita/View/Forms/EntryRow+.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Adwaita/View/Forms/EntryRow+.swift b/Sources/Adwaita/View/Forms/EntryRow+.swift index b11cfa8..f4c41da 100644 --- a/Sources/Adwaita/View/Forms/EntryRow+.swift +++ b/Sources/Adwaita/View/Forms/EntryRow+.swift @@ -21,8 +21,9 @@ extension EntryRow { appearFunctions.append { storage, _ in storage.fields[Self.textField] = text storage.notify(name: "text") { - if let binding = storage.fields[Self.textField] as? Binding { - binding.wrappedValue = .init(cString: gtk_editable_get_text(storage.pointer)) + let newValue = String(cString: gtk_editable_get_text(storage.pointer)) + if let binding = storage.fields[Self.textField] as? Binding, binding.wrappedValue != newValue { + binding.wrappedValue = newValue } } }