Skip to content

Commit

Permalink
Fix modifier wrapper overwriting previous state
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Sep 4, 2024
1 parent a851dbc commit de2379a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/Adwaita/View/Modifiers/ModifierWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct ModifierWrapper: AdwaitaWidget {
/// - type: The view render data type.
/// - Returns: The view storage.
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
let storage = content.storage(data: data, type: type)
let content = content.storage(data: data, type: type)
let storage = ViewStorage(content.pointer, content: [.mainContent: [content]])
update(storage, data: data, updateProperties: true, type: type)
return storage
}
Expand All @@ -62,7 +63,9 @@ struct ModifierWrapper: AdwaitaWidget {
updateProperties: Bool,
type: Data.Type
) where Data: ViewRenderData {
content.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
if let storage = storage.content[.mainContent]?.first {
content.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
}
guard updateProperties else {
return
}
Expand Down

0 comments on commit de2379a

Please sign in to comment.