Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix MVUX dead links #2581

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/Learn/Mvux/Advanced/Pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Here's what the app renders like:

## Offset pagination

Offset pagination is controlled via a State that stores the current page index in the Model, and the List-Feed depending on it, using [the `Select` operator](xref:Uno.Extensions.Mvux.Feeds#select-or-selectasync).
Offset pagination is controlled via a State that stores the current page index in the Model, and the List-Feed depending on it, using [the `Select` operator](xref:Uno.Extensions.Reactive.Feed#select).
When the user requests a new page, the current page index state is updated, thereby updating the dependent collection List-Feed.

Using the example started in [incremental loading above](#incremental-loading), we'll add another method to the service, which will disclose to the View how many items are there in total. Getting a count of items is more efficient than enumerating all entries. This is necessary to identify the total number of pages we have.
Expand Down Expand Up @@ -188,7 +188,7 @@ public partial record PeopleModel(IPeopleService PeopleService)
```

`PeopleManual` is a Feed that reacts to changes in the `CurrentPage` property and projects the current page data according to its number.
To accomplish this, the [`SelectAsync` operator](xref:Uno.Extensions.Mvux.Feeds#select-or-selectasync) of Feeds is used.
To accomplish this, the [`SelectAsync` operator](xref:Uno.Extensions.Reactive.Feed#selectasync) of Feeds is used.
The callback of this operator calls the service's `GetPeopleAsync` with the following arguments:

- `pageSize`: As with the [automatic incremental loading](#incremental-loading) example above we're passing the size of each page, except this time we are manually setting the page size to an arbitrary number via the `DefaultPageSize` constant, which is set to `20`.
Expand Down
4 changes: 2 additions & 2 deletions doc/Learn/Mvux/Advanced/Selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ You can listen and detect selection changes by either creating a feed that proje

#### Using the Select operator

Using the example above, we can project the `SelectedPerson` property to project or transform the current `Person`, using the `SelectedPerson`'s [`Where`](xref:Uno.Extensions.Mvux.Feeds#where) and [`Select`](xref:Uno.Extensions.Mvux.Feeds#select) operators.
Using the example above, we can project the `SelectedPerson` property to project or transform the current `Person`, using the `SelectedPerson`'s [`Where`](xref:Uno.Extensions.Reactive.Feed#where) and [`Select`](xref:Uno.Extensions.Reactive.Feed#select) operators.

```csharp
public IFeed<string> GreetingSelect => SelectedPerson.Select(person => person == null ? string.Empty : $"Hello {person.FirstName} {person.LastName}!");
Expand All @@ -141,7 +141,7 @@ A `TextBlock` can then be added in the UI to display the selected value:

#### Using the ForEach operator

Selection can also be propagated manually to a State using the [`ForEach`](xref:Uno.Extensions.Mvux.States#foreach) operator.
Selection can also be propagated manually to a State using the [`ForEach`](xref:Uno.Extensions.Reactive.State#foreach) operator.
First, we need to create a State with a default value, which will be used to store the processed value once a selection has occurred.

```csharp
Expand Down
2 changes: 1 addition & 1 deletion doc/Reference/Reactive/feed.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feeds are typically used to request data from services and expose it in a statel

Feeds are stateless and do not provide support for reacting to changes the user makes to the data on the View. The data can only be reloaded and refreshed upon request which is when the underlying task or `IAsyncEnumerable` will be invoked and the data refreshed. In other words, a feed is a read-only representation of the data received from the server.

In contrast to feeds, [states](xref:Uno.Extensions.Mvux.States) (`IState` or `IListState`), as the name suggests, are stateful and keep track of the latest value, as updates are applied.
In contrast to feeds, [states](xref:Uno.Extensions.Reactive.State) (`IState` or `IListState`), as the name suggests, are stateful and keep track of the latest value, as updates are applied.

## Sources: How to create a feed

Expand Down
2 changes: 1 addition & 1 deletion doc/Reference/Reactive/listfeed.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For example:
public IListFeed<string> Names => ListFeed.AsyncEnumerable(service.GetNames);
```

Pull and push are explained more in the [feeds page](xref:Uno.Extensions.Mvux.Feeds#creation-of-feeds).
Pull and push are explained more in the [feeds page](xref:Uno.Extensions.Reactive.Feed#sources:how-to-create-a-feed).
ajpinedam marked this conversation as resolved.
Show resolved Hide resolved

**Create**: Provides custom initialization for a `ListFeed`.

Expand Down
16 changes: 9 additions & 7 deletions doc/Reference/Reactive/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ In this example we'll add the method `IncrementSlider` that gets the current val
currentValue <= 99
? currentValue + 1
: 1;

await SliderValue.UpdateAsync(updater: incrementValue, ct);
}
```
Expand All @@ -290,6 +290,8 @@ public async ValueTask SetSliderMiddle(CancellationToken ct = default)

### Subscribing to changes

#### ForEach

The `ForEach` enables executing a callback each time the value of the `IState<T>` is updated.

This extension method takes a single parameter which is an async callback that takes two parameters. The first parameter is of type `T?`, where `T` is type of the `IState`, and represents the new value of the state. The second parameter is a `CancellationToken` which can be used to cancel a long running action.
Expand All @@ -304,12 +306,12 @@ For example:
public partial record Model
{
public IState<string> MyState => ...

public async ValueTask EnableChangeTracking()
{
MyState.ForEach(PerformAction);
}

public async ValueTask PerformAction(string item, CancellationToken ct)
{
...
Expand All @@ -324,13 +326,13 @@ Additionally, the `ForEach` method can be set using the Fluent API:
{
public IState<string> MyState => State.Value(this, "Initial value")
.ForEach(PerformAction);

public async ValueTask PerformAction(string item, CancellationToken ct)
{
...
}
}

```

### Commands
Expand All @@ -344,9 +346,9 @@ Let's modify the XAML [above](#how-to-bind-the-view-to-a-state) with the followi
...
<TextBlock Text="Set state value:"/>
<Slider Value="{Binding SliderValue, Mode=TwoWay}" />

<Button Content="Increment slider" Command="{Binding IncrementSlider" />

</StackPanel>
</Page>
```
Expand Down
Loading