Anyone have any ideas why in my robolectric test, ...
# compose
c
Anyone have any ideas why in my robolectric test, when some state changes pertaining to bottom sheet content, a composable called within the sheet content is not recomposed with the new state, but the
sheetContent
itself is? This test was passing fine before upgrading to compose 1.4
The code looks something like this:
Copy code
@Composable
fun MyBottomSheet(bottomSheetTopBarViewState: TopBarViewState) {
           ModalBottomSheetLayout(
                sheetContent = {
                        TitleBar(bottomSheetTopBarViewState) // a breakpoint is hit here when bottomSheetTopBarViewState changes
                        // ...other sheet content goes here...
                    }
                }
            )
}

@Composable
fun TitleBar(bottomSheetTopBarViewState: TopBarViewState) {
    Text(bottomSheetTopBarViewState.title) // a breakpoint is NOT hit here when bottomSheetTopBarViewState changes, and our assertion that the text is displayed fails because the node does not exist
}
If I pull the
Text
composable up a level to the
sheetContent
lambda, everything works fine and the test passes for some reason 🤔
The test also passes if the content is not in a bottom sheet