Skip to content

Conversation

@vatsashah45
Copy link
Contributor

GitHub Issue (If applicable): closes #2912

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the navigation region system during Hot Reload where regions could become orphaned when their parent cannot be found in the visual tree. The fix preserves a reference to the previous parent region and restores it if a new parent cannot be located during reassignment.

Key Changes:

  • Introduced a _previousParent field to track the last known parent region
  • Refactored ReassignParent() method with early-return guards and improved logic for Hot Reload scenarios
  • Added logging for various reassignment scenarios to aid debugging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vatsashah45 vatsashah45 requested review from dr1rrb and kazo0 January 5, 2026 16:24
@unodevops
Copy link
Contributor

⚠️⚠️ The build 189923 has failed on uno.extensions.


if (parent is not null)
{
Name = routeName;
Copy link
Contributor

@kazo0 kazo0 Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we needed to add this? Is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line existed before but was outside the parent check, I moved it inside if (parent is not null)

As the old code set Name = null unconditionally, which broke region identity and caused the test failures

Comment on lines +276 to +283
if (View is null || _isRoot || !View.GetAttached())
{
if (_logger.IsEnabled(LogLevel.Trace))
{
_logger.LogTraceMessage($"(Name: {Name}) Cannot reassign parent: View is null ({View is null}), IsRoot ({_isRoot}), or not attached ({!(View?.GetAttached() ?? false)})");
}
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is changing the logic since we would no longer set the Parent to null if we fall into this if because it returns early. Are we sure that's what we want to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, intentional

Original code did Parent = null then AssignParent(), which orphaned regions even when AssignParent would fail (View null/root/not attached)

The early return prevents unnecessary orphaning when we know reassignment won't work

if (View is null || _isRoot || !View.GetAttached())
    return;
    
IRegion? fallbackParent = null;
_previousParent?.TryGetTarget(out fallbackParent);
AssignParent(fallbackParent);  // If FindParentRegion fails, does Parent = fallbackParent

@unodevops
Copy link
Contributor

⚠️⚠️ The build 189947 has failed on uno.extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HR][Gaps][Navigation/MVUX] Re-adding Button Command binding breaks Tabbar navigation

5 participants