Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions Stellar.Maui.UnitTests/HotReloadSubscriptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ public void Subscription_IsDroppedWhenAViewOutsideAListLeavesTheWindow()
GC.KeepAlive(window);
}

[Fact]
public void HotReload_ReachesAViewThatIsInAWindow()
{
var page = new ContentPage();
var window = new Window(page);
var cell = new GridDataModelCell();

page.Content = cell;

// ReloadView hands its work to the main thread, which a test host does not
// have, so reaching that hand-off is the evidence that the view was reloaded.
var thrown = Record.Exception(static () => HotReloadService.UpdateApplication(null));

Assert.NotNull(thrown);
GC.KeepAlive(window);
Comment on lines +78 to +79
}

private static bool IsSubscribed(ITestCell cell)
{
var handlers =
Expand Down
2 changes: 1 addition & 1 deletion Stellar.Maui/MauiViewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void Deactivate(IStellarView<TViewModel> view, TViewModel? parkedViewMod

private void HandleHotReload(Type[]? updatedTypes)
{
if (_reloadView is null || _reloadView.TryGetTarget(out var target) || target is not IStellarView<TViewModel> isv)
if (_reloadView is null || !_reloadView.TryGetTarget(out var target) || target is not IStellarView<TViewModel> isv)
{
return;
}
Expand Down
Loading