Skip to content

Commit

Permalink
chore: update property name
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Jan 8, 2025
1 parent 3b8f6d6 commit ed5a927
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions doc/Learn/Mvux/ListStates.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public async ValueTask MakeUpperCase(CancellationToken ct = default)
var itemToUpdate = new MyItem(2, "Two");

await MyItems.UpdateItemAsync(
oldT: itemToUpdate,
oldItem: itemToUpdate,
updater: item => item with { Value = item.Value.ToUpper()},
ct: ct);
}
Expand All @@ -163,8 +163,8 @@ public async ValueTask MakeUpperCase(CancellationToken ct = default)
var itemToUpdate = new MyItem(2, "Two");

await MyItems.UpdateItemAsync(
oldT: itemToUpdate,
newT: new MyItem(2, "TWO"),
oldItem: itemToUpdate,
newItem: new MyItem(2, "TWO"),
ct: ct);
}
```
Expand Down
18 changes: 9 additions & 9 deletions src/Uno.Extensions.Reactive/Core/ListState.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,24 @@ public static ValueTask RemoveAllAsync<T>(this IListState<T> state, Predicate<T>


/// <summary>
/// Updates all items from a list state that match the key of <paramref name="oldT"/>.
/// Updates all items from a list state that match the key of <paramref name="oldItem"/>.
/// </summary>
/// <typeparam name="T">The type of the items in the list.</typeparam>
/// <param name="state">The list state onto which the item should be added.</param>
/// <param name="oldT">The old value of the item.</param>
/// <param name="newT">The new value for the item.</param>
/// <param name="oldItem">The old value of the item.</param>
/// <param name="newItem">The new value for the item.</param>
/// <param name="ct">A token to abort the async add operation.</param>
/// <returns></returns>
public static ValueTask UpdateItemAsync<T>(this IListState<T> state, T oldT, T newT, CancellationToken ct = default) where T : IKeyEquatable<T>
public static ValueTask UpdateItemAsync<T>(this IListState<T> state, T oldItem, T newItem, CancellationToken ct = default) where T : IKeyEquatable<T>
=> state.UpdateDataAsync(
itemsOpt => itemsOpt.Map(items =>
{
var updated = items;
foreach (var item in items)
{
if (item.KeyEquals(oldT))
if (item.KeyEquals(oldItem))
{
updated = items.Replace(item, newT);
updated = items.Replace(item, newItem);
}
}
return updated;
Expand All @@ -151,11 +151,11 @@ public static ValueTask UpdateItemAsync<T>(this IListState<T> state, T oldT, T


/// <summary>
/// Updates all items from a list state that match the key of <paramref name="oldT"/>.
/// Updates all items from a list state that match the key of <paramref name="oldItem"/>.
/// </summary>
/// <typeparam name="T">The type of the items in the list.</typeparam>
/// <param name="state">The list state onto which the item should be added.</param>
/// <param name="oldT">The old value of the item.</param>
/// <param name="oldItem">The old value of the item.</param>
/// <param name="updater">How to update items.</param>
/// <param name="ct">A token to abort the async add operation.</param>
/// <returns></returns>
Expand All @@ -166,7 +166,7 @@ public static ValueTask UpdateItemAsync<T>(this IListState<T> state, T oldItem,
var updated = items;
foreach (var item in items)
{
if (item.KeyEquals(oldT))
if (item.KeyEquals(oldItem))
{
updated = items.Replace(item, updater(item));
}
Expand Down

0 comments on commit ed5a927

Please sign in to comment.