Skip to content

Commit 0b9e9ca

Browse files
committed
Updates
1 parent fdc6a78 commit 0b9e9ca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aspnetcore/blazor/components/cascading-values-and-parameters.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Calling <xref:Microsoft.AspNetCore.Components.CascadingValueSource%601.NotifyCha
9999
In the following example:
100100

101101
* `NotifyingDalek` implements <xref:System.ComponentModel.INotifyPropertyChanged> to notify clients that a property value has changed. When the `Units` property is set, the <xref:System.ComponentModel.PropertyChangedEventHandler> (`PropertyChanged`) is invoked.
102-
* The `SetUnitsToOneThousand` method can be triggered by subscribers to set `Units` to 1,000 with a simulated processing delay.
102+
* The `SetUnitsToOneThousandAsync` method can be triggered by subscribers to set `Units` to 1,000 with a simulated processing delay.
103103

104104
Keep in mind for production code that any change in state (any property value change of the class) causes all subscribed components to rerender, regardless of which part of the state they use. We recommend creating granular classes, cascading them separately with specific subscriptions to ensure that only components subscribed to a specific portion of the application state are affected by changes.
105105

@@ -153,13 +153,13 @@ namespace Microsoft.Extensions.DependencyInjection;
153153

154154
public static class CascadingStateServiceCollectionExtensions
155155
{
156-
public static IServiceCollection AddCascadingStateNotifier<T>(
156+
public static IServiceCollection AddNotifyingCascadingValue<T>(
157157
this IServiceCollection services, T state, bool isFixed = false)
158158
where T : INotifyPropertyChanged
159159
{
160-
return serviceCollection.AddCascadingValue<T>(sp =>
160+
return services.AddCascadingValue(sp =>
161161
{
162-
return new CascadingStateValueSource<T>(value, isFixed);
162+
return new CascadingStateValueSource<T>(state, isFixed);
163163
});
164164
}
165165

@@ -172,7 +172,7 @@ public static class CascadingStateServiceCollectionExtensions
172172
public CascadingStateValueSource(T state, bool isFixed = false)
173173
: base(state, isFixed = false)
174174
{
175-
this.state= state;
175+
this.state = state;
176176
source = new CascadingValueSource<T>(state, isFixed);
177177
this.state.PropertyChanged += HandlePropertyChanged;
178178
}
@@ -195,7 +195,7 @@ The type's <xref:System.ComponentModel.PropertyChangedEventHandler> (`HandleProp
195195
In the `Program` file&dagger;, `NotifyingDalek` is passed to create a <xref:Microsoft.AspNetCore.Components.CascadingValueSource%601> with an initial `Unit` value of 888 units:
196196

197197
```csharp
198-
builder.Services.AddCascadingStateNotifier<NotifyingDalek>(
198+
builder.Services.AddNotifyingCascadingValue<NotifyingDalek>(
199199
new NotifyingDalek() { Units = 888 });
200200
```
201201

0 commit comments

Comments
 (0)