Skip to content

Conversation

austinw-fineart
Copy link
Contributor

Fixes a regression caused by 688ab3c where calling hostConnected / hostDisconnected in rapid succession can cause root to become null. This regression can be experienced in Angular where content projection causes it to call hostConnected → hostDisconnected → hostConnected in rapid succession. I'm not familiar enough with Angular's internals to know why it needs to do this multiple times in a row but regardless the two lifecycles should be mirrored.

Fixes a regression caused by 688ab3c where calling hostConnected / hostDisconnected in rapid succession can cause root to become null.
@asyncliz
Copy link
Collaborator

asyncliz commented Sep 2, 2025

Seems like a simple fix to me, I'll import to run tests. Is there any way to simulate Angular's behavior? Would directly calling the lifecycles in the order you describe be a way to test it?

@austinw-fineart
Copy link
Contributor Author

@asyncliz Here's a Lit Playground that simulates what it'd be like to call the lifecycles manually.

@asyncliz asyncliz self-requested a review September 4, 2025 16:56
Copy link
Collaborator

@asyncliz asyncliz left a comment

Choose a reason for hiding this comment

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

LGTM! I'll see if there are any complications when testing

@copybara-service copybara-service bot merged commit 834a166 into material-components:main Sep 8, 2025
4 checks passed
@austinw-fineart austinw-fineart deleted the patch-1 branch September 9, 2025 01:35
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.

2 participants