Search code examples
androidandroid-jetpack-compose

java.lang.IllegalStateException: Place was called on a node which was placed already


I have java.lang.IllegalStateException: Place was called on a node which was placed already error when trying to navigate back using

navController.navigateUp()

from one specific screen, i can't find the problem with it

I don't know what could possibly be wrong with my navigation, other alike screens works fine

I found the problem, on first screen i have this code

LazyVerticalGrid(
            modifier = Modifier.padding(start = 0.dp, end = 0.dp),
            columns = GridCells.Fixed(2),
        ) {
            item(span = { GridItemSpan(maxLineSpan) }) {
                AssetTopItem(
                    modifier = Modifier
                        .padding(bottom = 20.dp, start = 15.dp, end = 15.dp),
                    item = uiState.asset
                )
            }
            item(span = { GridItemSpan(maxLineSpan) }) {
                ChartBlock(
                    chartState = uiState.chartState,
                    intervalsState = uiState.intervalState,
                    updateData = updateData,
                    changeInterval = changeInterval
                )
            }
            item(span = { GridItemSpan(maxLineSpan) }) {
                Column(
                    Modifier
                        .fillMaxWidth()
                        .background(
                            color = backgroundBlack,
                            shape = RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp)
                        )
                ) {
                    CryptoTabs(modifier = Modifier, state = uiState.tabsState, setType = setTab)
                    OrdersBlock(state = uiState.offersState, scope = this@LazyVerticalGrid)
                }
            }
        }

I'm navigating to second screen from this one and when i'm navigating back i have a crash. But when my first screen has code like this

LazyVerticalGrid(
            modifier = Modifier.padding(start = 0.dp, end = 0.dp),
            columns = GridCells.Fixed(2),
        ) {
            item(span = { GridItemSpan(maxLineSpan) }) {
                AssetTopItem(
                    modifier = Modifier
                        .padding(bottom = 20.dp, start = 15.dp, end = 15.dp),
                    item = uiState.asset
                )
            }

            item(span = { GridItemSpan(maxLineSpan) }) {
                Column(
                    Modifier
                        .fillMaxWidth()
                        .background(
                            color = backgroundBlack,
                            shape = RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp)
                        )
                ) {
                    CryptoTabs(modifier = Modifier, state = uiState.tabsState, setType = setTab)
                    OrdersBlock(state = uiState.offersState, scope = this@LazyVerticalGrid)
                }
            }
            item(span = { GridItemSpan(maxLineSpan) }) {
                ChartBlock(
                    chartState = uiState.chartState,
                    intervalsState = uiState.intervalState,
                    updateData = updateData,
                    changeInterval = changeInterval
                )
            }
        }

I don't have a crash :) wtf


Solution

  • Reason to this exception was transitive dependency on alpha version of navigation library