Skip to content

Commit

Permalink
modified the Blazor component base classes to trigger WhenActivated()
Browse files Browse the repository at this point in the history
See issue reactiveui#3413
  • Loading branch information
imundy7 committed Dec 5, 2022
1 parent 5acc920 commit 780c771
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public class ReactiveInjectableComponentBase<T> : ComponentBase, IViewFor<T>, IN
}

_viewModel = value;
if (_viewModel is IActivatableViewModel avm)
{
Activated.Subscribe(_ => avm.Activator.Activate());
Deactivated.Subscribe(_ => avm.Activator.Deactivate());
}
OnPropertyChanged();
}
}
Expand Down Expand Up @@ -139,4 +144,4 @@ protected virtual void Dispose(bool disposing)
_disposedValue = true;
}
}
}
}

0 comments on commit 780c771

Please sign in to comment.