Skip to content

Conversation

@ShaneK
Copy link
Member

@ShaneK ShaneK commented Jan 5, 2026

Issue number: resolves internal


What is the current behavior?

When ion-tab-bar is rapidly mounted and unmounted, a race condition in connectedCallback can cause the keyboard controller to be created after the component has been disconnected. This results in orphaned event listeners (keyboardWillShow, keyboardWillHide) on the window object that are never cleaned up, causing a memory leak.

What is the new behavior?

The keyboard controller is now properly destroyed in all scenarios:

  • If the component is disconnected while createKeyboardController is pending, the promise is tracked and destroyed when it resolves
  • If a new connectedCallback runs before the previous async completes, the stale controller is destroyed

The promise tracking pattern ensures only the most recent async operation assigns its result

Does this introduce a breaking change?

  • Yes
  • No

Other information

Current dev build:

8.7.17-dev.11767895575.16ea7cef

I was unable to find a way to create tests that accurately identified if this problem was occurring. Memory leaks are notoriously difficult to created automated tests for. I ultimately removed my previous attempts because I didn't want to give a false sense of security.

@ShaneK ShaneK requested a review from a team as a code owner January 5, 2026 17:58
@ShaneK ShaneK requested a review from thetaPC January 5, 2026 17:58
@vercel
Copy link

vercel bot commented Jan 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
ionic-framework Ready Ready Preview, Comment Jan 8, 2026 6:06pm

@github-actions github-actions bot added the package: core @ionic/core package label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants