Hi guys, three is something wrong with my code? Be...
# compose
s
Hi guys, three is something wrong with my code? Because is crashing, I reported it at https://issuetracker.google.com/issues/143595001
k
what is the idea behind this?
Copy code
@Model
object MyHomeState
do you want to have a global state?
🧌 1
I would suggest to bring it inside the @Composable function.
Copy code
@Model
data class HomeState {
    val contentList = modelListOf<Content>()
}

@Composable
private fun MyHomeContent() {
  var myHomeState = +memo{ HomeState() }
// ...
}
s
I find this bug in other project of mine, and I try to reproduce the same crash.
l

https://i.imgflip.com/3es4oi.jpg

😂 1
Sorry when is it crashing for you?
s
when adding entry on a ModelList used inside a Table (button onClick adds a new entry)
l
I can run it without any crash
I get an entire page(and more) of entries in the table
BTW: the table does not become scrollable - that might be the real problem 😛
s
Still crashing here :S
l
Well, that means the error is not in the code 🙂
k
are you using the latest of compose? or the library version? have you synced lately?
s
Version that I'm using: 0.1.0-dev02 The project is the jetnews, I just replace the home screen to this code to test if the crash is reproduced
l
Are you wrapping it with a
Theme
?
s
The application? is wrapped inside a MaterialTheme (just for clarify if I was not clear before, the application runs, but crashs when I click in the INSERT button (adding entry to the ModelList that uses used on Table, the stracktrace is reported in the issue link)
c
I took this bug and tried to reproduce this. Like, @Luca Nicoletti, I couldn't. Is there something I am missing? Whenever this exception occurs it is because the slot table is misaligned during recomposition. This is either a compiler or compose-runtime bug or both. This might be indicative of a more serious issue so I really would like to get to the bottom of this.
s
@Chuck Jazdzewski [G] I create a empty project and try to reproduce, I found that to reproduce need to be inside a bodyContent from a ModalDrawerLayout, my bad
c
I reproduced and diagnosed the issue and added a comment to the bug. We are generating the wrong code for line Table.kt:498 which causes the slot table to become misaligned. Not sure why the
ModalDrawerLayout
is necessary to reproduce this but probably purtubes the composition enough to run into this. As for missing a step. That seems like a requirement for being a programmer apparently as it happens all the time. I just wanted to make sure you knew I was not just deflecting the issue with "works on my machine" type response. I really wanted to dig in.
💯 1
👍 4