Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Move StateHasChanged to PageViewModel
Browse files Browse the repository at this point in the history
Move StateHasChanged to PageViewModel
  • Loading branch information
ligowsky authored Apr 22, 2024
2 parents eb2da6c + e2a02f3 commit 991719f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/BitzArt.Blazor.MVVM/Components/PageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public abstract class PageBase<TViewModel> : ComponentBase, IPersistentComponent
[Inject]
protected TViewModel ViewModel { get; set; } = null!;

PersistentComponentState IPersistentComponent.ComponentState => throw new NotImplementedException();

/// <summary>
/// Method invoked when the component is ready to start, having received its initial
/// parameters from its parent in the render tree. Override this method if you will
Expand Down
18 changes: 9 additions & 9 deletions src/BitzArt.Blazor.MVVM/ViewModels/PageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ public virtual Task InitializeAsync()
return Task.CompletedTask;
}

internal abstract Task PersistStateAsync();
internal virtual Task PersistStateAsync() => Task.CompletedTask;

/// <summary>
/// Notifies the component that the state has changed.
/// </summary>
protected void StateHasChanged()
{
Component.StateHasChanged();
}
}

/// <summary>
Expand Down Expand Up @@ -81,12 +89,4 @@ internal override Task PersistStateAsync()

return Task.CompletedTask;
}

/// <summary>
/// Notifies the component that the state has changed.
/// </summary>
protected void StateHasChanged()
{
Component.StateHasChanged();
}
}

0 comments on commit 991719f

Please sign in to comment.