Skip to content

Ensure controller is still present#19408

Merged
nielslyngsoe merged 4 commits intorelease/16.0from
v16/hotfix/ensure-controller-is-still-present
May 26, 2025
Merged

Ensure controller is still present#19408
nielslyngsoe merged 4 commits intorelease/16.0from
v16/hotfix/ensure-controller-is-still-present

Conversation

@nielslyngsoe
Copy link
Copy Markdown
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 AI review requested due to automatic review settings May 24, 2025 09:30
Copy link
Copy Markdown
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 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
…ost.mixin.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nielslyngsoe nielslyngsoe enabled auto-merge (squash) May 24, 2025 09:32
@nielslyngsoe nielslyngsoe merged commit 95c6173 into release/16.0 May 26, 2025
23 checks passed
@nielslyngsoe nielslyngsoe deleted the v16/hotfix/ensure-controller-is-still-present branch May 26, 2025 07:34
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.

4 participants