-
Notifications
You must be signed in to change notification settings - Fork 101
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
DialogCollator destroys/rebuild instead of dismiss/show #1211
Conversation
2b8ee77
to
9c847a0
Compare
So this is now very, very green, but I'm really torn about whether it's a good idea. On the one hand, I'm tired of obscure bug hunts that boil down to "oh this view is bad about handling being attached to a window more than once." On the other hand, relying on view code to use view state correctly in order to smoothly be reordered doesn't seem great either -- although at least they already have to do that for config change. Going to try harder to understand why Once again, thank you @zach-klippenstein for all these wonderful unit tests! |
9c847a0
to
a14ab07
Compare
Initial testing reveals:
|
Actually, I wasn't re-showing all the dialogs in that first test. Fixing that reveals that Testing with So: why didn't that fix do the job for us in production? |
a14ab07
to
2399303
Compare
Updated the commit message to explain why we're going to go ahead and merge this after all. tl;dr: Compose 1.6.8 breaks what is fixed by #1213 |
67e5f5c
to
66c65e9
Compare
be4481a
to
497496e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand it at a high-level but I'm trusting you with the ViewState
stuff 'cause that's outta my wheelhouse!
workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt
Outdated
Show resolved
Hide resolved
Fair. The good news is that I realized I need to fix these because various tests broke. I'm pretty confident. |
When `DialogCollator` has to reorder, it did so by calling `Dialog.dismiss()` and `Dialog.show()`. #1213 fixed a problem that caused for `ComposeView`, but that fix is undone by Compose 1.6.8. @vumngoc dug in to see why and discovered: > The `onClick` in `Modifier.clickable` is passed all the way down to `pointerInputHandler` in `SuspendingPointerInputModifierNodeImpl` (when the screen is responsive, you should see `pointerInputHandler()` being called in `SuspendingPointerInputModifierNodeImpl#onPointerEvent`). > > After shuffling the overlays, even though the `ClickableNode` is found and `SuspendingPointerInputModifierNodeImpl#onPointerEvent` is called, `pointerInputHandler()` is never called because the `pointerInputJob` in `SuspendingPointerInputModifierNodeImpl` was launched from a canceled coroutineScope. Tracking down that coroutineScope shows that it was canceled when `DialogCollator` calls `Dialog.dismiss` -> `onViewDetachedFromWindow` -> `Recomposer.cancel()`. So it makes sense why destroying/rebuilding instead of dismissing and reusing the dialog fixes this issue. Still need to put together a non-workflow repro sample and submit a bug to the Compose team, but this unblocks our move to Compose 1.6.8 in the meantime.
497496e
to
fae88ea
Compare
When
DialogCollator
has to reorder, it did so by callingDialog.dismiss()
andDialog.show()
. #1213 fixed a problem that caused forComposeView
, but that fix is undone by Compose 1.6.8. @vumngoc dug in to see why and discovered:Still need to put together a non-workflow repro sample and submit a bug to the Compose team, but this unblocks our move to Compose 1.6.8 in the meantime.