Skip to content

Conversation

@OmidID
Copy link
Contributor

@OmidID OmidID commented Jun 3, 2025

No description provided.

@OmidID OmidID changed the title #98 fix issue of crash when host navigate back fix issue of crash when host navigate back Jun 3, 2025
@OmidID OmidID requested a review from Copilot June 3, 2025 21:21

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@OmidID OmidID requested a review from Copilot June 3, 2025 21:24

This comment was marked as outdated.

@OmidID OmidID requested a review from Copilot June 3, 2025 21:26
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 crash when navigating back by updating the child control reordering logic in StackContentView.

  • Replaces unconditional remove/add with a move-to-end operation when the control already exists.
  • Preserves original addition behavior for new controls.
Comments suppressed due to low confidence (2)

src/AvaloniaInside.Shell/StackContentView.cs:62

  • Calling Contains then IndexOf causes two scans of the collection; consider using IndexOf once (and checking for >= 0) to detect existence and get the index in a single pass.
if (Children.Contains(control))

src/AvaloniaInside.Shell/StackContentView.cs:65

  • Add unit tests for the branches where the control already exists as the last element (to verify Move is skipped) and where the control is new (to verify it's added correctly).
if (currentIndex != Children.Count - 1)

@OmidID OmidID merged commit c580506 into develop Jun 3, 2025
4 checks passed
OmidID added a commit that referenced this pull request Sep 3, 2025
* Update dependency Projektanker.Icons.Avalonia.FontAwesome to 8.4.0 (#86)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency Projektanker.Icons.Avalonia to 8.4.0 (#85)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency Projektanker.Icons.Avalonia to v9 (#95)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency Projektanker.Icons.Avalonia.FontAwesome to v9 (#96)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* fix issue of crash when host navigate back (#100)

* #98 fix issue of crash when host navigate back

* Update src/AvaloniaInside.Shell/StackContentView.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dependency ReactiveUI to 20.3.1 (#99)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update avalonia monorepo to 11.3.1 (#101)

* Update avalonia monorepo to 11.3.1

* Update src/Directory.Packages.props

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Directory.Packages.props

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dependency Xamarin.AndroidX.Core.SplashScreen to 1.0.1.16 (#102)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update avalonia monorepo to 11.3.2 (#103)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency ReactiveUI to 20.4.1 (#104)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Synchronize window title with navigation bar header (#105)

* Initial plan

* Implement window title synchronization with navigation bar header

Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

* Clean up implementation and restore original target frameworks

Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

* Implement OnNavigate event and revert primary constructor changes

Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

* Restore original target frameworks

Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

* Update avalonia monorepo to 11.3.4 (#108)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency Xamarin.AndroidX.Core.SplashScreen to 1.0.1.17 (#109)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update dependency ReactiveUI to v21 (#110)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Update avalonia monorepo to 11.3.5 (#111)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Release version 1.3.2.2 - Update package version in csproj and README (#112)

* Initial plan

* Update version to 1.3.2.2 in csproj and README

Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>

---------

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: OmidID <956077+OmidID@users.noreply.github.com>
@OmidID OmidID deleted the fix/crash-when-host-back-history branch September 3, 2025 19:10
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.

2 participants