Repository navigation
fix(maui): reload the view on hot reload - #53
Open
michaelstonis wants to merge 1 commit into
Open
michaelstonis wants to merge 1 commit into
michaelstonis wants to merge 1 commit into
Conversation
The handler returned early whenever its view was still alive: a refactor to WeakReference<T> in December 2023 dropped the negation in front of TryGetTarget, so ReloadView has not run on hot reload since. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new test leaves a handler attached to a process-wide static event, leaking state into later tests.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes MAUI hot reload so live Stellar views receive reload events.
Changes:
- Corrects the weak-reference target check.
- Adds regression coverage for a view attached to a window.
| File | Description |
|---|---|
Stellar.Maui/MauiViewManager.cs |
Restores hot-reload dispatch to live views. |
Stellar.Maui.UnitTests/HotReloadSubscriptionTests.cs |
Tests hot-reload event delivery. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+78
to
+79
| Assert.NotNull(thrown); | ||
| GC.KeepAlive(window); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
MauiViewManager.HandleHotReloadreturned early whenever its view was still alive:A live view makes
TryGetTargettrue and returns; a collected one leavestargetnull and returns.isv.ReloadView()was unreachable. The negation was dropped in d33cee3 (December 2023), when the field moved fromWeakReferencetoWeakReference<T>(previously!(_reloadView?.IsAlive ?? false)), so MAUI hot reload has not re-runSetupUserInterfaceand the bindings since. The Avalonia, Uno, WinUI and WPF view managers hold the view directly and are not affected.Found while reviewing
v2.1.3...v2.2.0; the line predates that range.What
Restores the
!, and adds a test that raises the hot reload event for a view in a window.Verification
ReloadViewreaches its main-thread hand-off, because a test host has no main thread; the reload itself is not exercised.Stellar.Maui.UnitTests: 196/196 locally onnet10.0.🤖 Generated with Claude Code