Skip to content

Session Replay doesn't show bottom sheets opened from another bottom sheet in Jetpack compose #3426

Description

@salah-8

Describe the bug

We are trying session replay feature on our compose app and it seems fine but the only issue currently is when we have a bottom sheet that has a button which opens another bottom sheet, the second sheet that was opened is invisible in the session replay recording on the console.

Reproduction steps

We use the dialog way for handling bottom sheets in a nav graph. for example here is what our nav graph look like:

NavHost(
        navController = navController,
        startDestination = startDestination,
    ) {
        composable<ScreenOneRoute> {
            SomeOne()
        }

        dialog<BottomSheetOneRoute> {
              BottomSheetOne()
        }

        dialog<BottomSheetTwoRoute> {
              BottomSheetTwo()
        }
}

and to open BottomSheetOne for example we call the normal navController.navigate() function with popUpTo the current screen (not sheet) to dismiss any current bottom sheets. and same for openning BottomSheetTwo from an action inside BottomSheetOne we call the same navigate function.

After some trial with it I found a workaround that avoids this issue and shows the second bottom sheet by waiting for the current one to be hidden:

val scope = rememberCoroutineScope()
scope.launch {
        if (navController.popBackStack<T>(inclusive = false)) {
            withFrameNanos { } // waits a frame for the current sheet to dispose before starting the next one
            navController.navigate(route)
        }
    }

but I'm not sure yet about the issues that could happen by using this way so it would be safer and cleaner for it to work with the normal navigate functin without any workarounds

Logcat logs

No response

Expected behavior

No response

Affected SDK versions

3.9.1

Latest working SDK version

N/A

Did you confirm if the latest SDK version fixes the bug?

Yes

Kotlin / Java version

No response

Gradle / AGP version

No response

Other dependencies versions

No response

Device Information

No response

Other relevant information

Not sure if it matters but keep in mind that we are on a KMP project so this is Compose Multiplatform with only Android target, no iOS for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions