Skip to content

Commit

Permalink
Fixed attaching bindings multiple times in BindableViewHolder inheritors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Leonenko committed Sep 25, 2024
1 parent 55eee72 commit 2c1c0f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public sealed override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup pare
public void DoAttachBindings()
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
_existingBindableViewHolders.Where(x => x.DataContext != null)
_existingBindableViewHolders
.Where(x => !x.AreBindingsAttached && x.DataContext != null)
.Apply(x => x.DoAttachBindings());
}

Expand Down
6 changes: 0 additions & 6 deletions Softeq.XToolkit.Bindings.Droid/Bindable/BindableViewHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ protected virtual void OnItemViewClick(object sender, EventArgs e)

public virtual void DoAttachBindings()
{
if (AreBindingsAttached)
{
return;
}

AreBindingsAttached = true;
_subscriptionsComponent.CreateSubscriptions();
}
Expand All @@ -83,7 +78,6 @@ public virtual void DoDetachBindings()
this.DetachBindings();

_subscriptionsComponent.DisposeSubscriptions();

AreBindingsAttached = false;
}

Expand Down

0 comments on commit 2c1c0f4

Please sign in to comment.