Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Fix ComboRow's values not updating properly
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Feb 4, 2024
1 parent 478dd67 commit 3ee1cf3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Sources/Adwaita/View/Forms/ComboRow+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ extension ComboRow {
updateFunctions.append { storage in
if let list = storage.fields[Self.stringList] as? OpaquePointer {
let old = storage.fields[Self.values] as? [Element] ?? []
var new = values.filter { element in !old.contains { $0.id == element.id } }
new = old + new
old.identifiableTransform(
to: new,
to: values,
functions: .init { index, element in
gtk_string_list_remove(list, .init(index))
gtk_string_list_append(list, element.description)
Expand All @@ -53,7 +51,7 @@ extension ComboRow {
gtk_string_list_append(list, element.description)
}
)
storage.fields[Self.values] = new
storage.fields[Self.values] = values
}
}
}
Expand Down

0 comments on commit 3ee1cf3

Please sign in to comment.