Skip to content

[Pager] Are you trying to use the state of the disposed SubcomposeLayout? #1140

@huaweikai

Description

@huaweikai

Description
This is what happens when I use the HorizontalPager and make it display a few Lazycolumns

The problem occurs in compose version 1.2.0-alpha08

This is fine for compose 1.2.0-Alpha07 and pager 0.24.6-alpha

java.lang.IllegalArgumentException: Inconsistency between the count of nodes tracked by the state (0) and the children count on the SubcomposeLayout (4). Are you trying to use the state of the disposed SubcomposeLayout?

Steps to reproduce

            HorizontalPager(count = 3,Modifier.fillMaxSize()) { page->
                when(page){
                    0->{
//                        Text(text = "$page")
                        LazyColumn{
                            items(100){
                                Text(text = "$it")
                            }
                        }
                    }
                    1->{
                        LazyColumn{
                            items(100){
                                Text(text = "$it")
                            }
                        }
//                        Text(text = "$page")
                    }
                    2->{
                        LazyColumn{
                            items(100){
                                Text(text = "$it")
                            }
                        }
//                        Text(text = "$page")
                    }
                }
            }

Expected behavior

Additional context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions