Skip to content

Ensure controller is still present #19408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release/16.0
Choose a base branch
from

Conversation

nielslyngsoe
Copy link
Member

@nielslyngsoe nielslyngsoe commented May 24, 2025

Ensure a controller is still present to avoid calling hostConnected on a controller that already have been removed again.

Its a bit of an edge case, but if the user navigates super fast, or the router resolved a route that then gets replaced within a JS cycle after then this can occur.

@Copilot Copilot AI review requested due to automatic review settings May 24, 2025 09:30
Copy link
Contributor

@Copilot 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 adds a presence check to ensure a controller hasn’t been removed before calling hostConnected.

  • Updated the runtime check inside the deferred promise to also verify the controller is still in the host’s list.
  • Adjusted the inline comment to reflect the new condition.

@nielslyngsoe nielslyngsoe requested a review from iOvergaard May 24, 2025 09:31
@nielslyngsoe nielslyngsoe enabled auto-merge (squash) May 24, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant