Skip to content
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

[Navigation Material] Fix Bottom Sheet Re-Appearing after Dismissal #741

Closed

Conversation

jossiwolf
Copy link
Collaborator

Our show calls are getting cancelled due to a race condition (https://issuetracker.google.com/issues/200980998) so we can't rely on their completion as a signal that the sheet is shown and we can mark the sheet's back stack entry's transition as complete. I talked to Matvei and he suggested using withFrameNanos which works. It's more of a workaround/hack and I'd like to put a better solution in place soon, but this works for the time being.

Test: Existing tests still pass (as they did despite the race condition...). Will try to create tests that fail before the fix. Manual testing apart from that.
Fixes: #725, #720, #700

Our `show` calls are getting cancelled due to a race condition (https://issuetracker.google.com/issues/200980998) so we can't rely on their completion as a signal that the sheet is shown and we can mark the sheet's back stack entry's transition as complete. Using `withFrameNanos`, we try to wait until the sheet is visible.

Test: Existing tests still pass (as they did despite the race condition...). Will try to create tests that fail before the fix. Manual testing apart from that.
Fixes: google#725, google#720, google#700
@google-cla google-cla bot added the cla: yes label Sep 28, 2021
@jossiwolf jossiwolf changed the title Reliably mark showing sheet's back stack entry as complete [Navigation Material] Fix Bottom Sheet Re-Appearing after Dismissal Sep 28, 2021
Copy link
Collaborator

@ianhanniballake ianhanniballake left a comment

Choose a reason for hiding this comment

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

What a hack. If it works, it works though.

If you can, I'd strongly suggest working on upstreaming a fix for this cancellation issue into Compose 1.1 (which we might be able to cherry pick to a Compose 1.0.X bug fix release) as I'd really prefer to remove these hacks and the need for ExperimentalCoroutinesApi here.

@jossiwolf
Copy link
Collaborator Author

jossiwolf commented Sep 30, 2021

There's nothing I'd love more but I don't see where we could apply this to bottom sheet to improve :/ Trying to contribute another fix though and I'm hoping that that'll improve things!

@chrisbanes chrisbanes enabled auto-merge (squash) September 30, 2021 07:32
@chrisbanes
Copy link
Contributor

Closing as this was merged as part of #742

@chrisbanes chrisbanes closed this Sep 30, 2021
@jossiwolf jossiwolf deleted the sheet-entry-not-marked-as-completed branch September 30, 2021 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect lifecycle events happen for BottomSheet
3 participants