Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Jetpack Compose component(s) used:Normal compose
Android Studio Build:2024.1.1
Kotlin version:1.9
Steps to Reproduce or Code Sample to Reproduce:
1.Creating a compose view
2.attach to window(view tree can find lifecycle1)
3.detach from window
4.reattach to window(view tree can find lifecycle2, and lifecycle1 destroyed)
5.view disappear
Reason:
When reattachingToWindow, the view's lifeCycleOwner will be updated. The viewTreeOwners of AndroidComposeView will be updated when reattachingToWindow, but the listening objects of composition will not be updated. Therefore, composition is always in the dispose state and will not be displayed.
Now we remove the child view when detaching from the window and set the recycling strategy to detach from the window.
Is there a better way to reuse views?