https://kotlinlang.org logo
#compose
Title
# compose
j

jaqxues

11/11/2020, 7:51 PM
After updating to Alpha07:
java.lang.IllegalArgumentException: Invalid slot table detected
👀 1
j

jim

11/11/2020, 7:52 PM
🤦‍♂️
We recently rewrote the slottable and hoped no one would notice. Looks like a bug on our end, sorry about that! Can you create a minimal repro and file a bug please?
j

jaqxues

11/11/2020, 7:52 PM
Already working on that
🙏 1
j

John O'Reilly

11/11/2020, 7:53 PM
have you updated to v1.0.0-alpha02 of
navigation-compose
?
j

jaqxues

11/11/2020, 7:53 PM
yes
Yeah, it complains about Slot tables when using (navigation) alpha01 with (compose) alpha07 too
Not the issue though
j

John O'Reilly

11/11/2020, 7:55 PM
yeah, just went back to alpha01 of navigation and it's different crash all right
Copy code
NoSuchFieldError: No field Companion of type Landroidx/compose/runtime/SlotTable$Companion; in class Landroidx/compose/runtime/SlotTable; or its superclasses (declaration of 'androidx.compose.runtime.SlotTable' appears in
i

Ian Lake

11/11/2020, 8:02 PM
You can't mix and match versions - Nav alpha02 builds against Compose alpha07
j

John O'Reilly

11/11/2020, 8:03 PM
yeah, in my case I had forgotten to update to alpha02 when I got that......had remembered that there was some kind of "slot" error so had thought maybe it was same issue that @jaqxues was having
I had been waiting on
accompanist
update to fully test....but with that now I'm still getting that
SlotTable
crash I posted above
pushed changes to this branch if anyone wants to try it out https://github.com/joreilly/BikeShare/tree/compose_alpha07
not seeing same issue with https://github.com/joreilly/PeopleInSpace for some reason.....but in that case seeing color/size of title bar text change for some reason after going to alpha07
j

jaqxues

11/11/2020, 8:27 PM
Probly using the deprecated Text from the foundation package
Use the Text from the material package
j

John O'Reilly

11/11/2020, 8:31 PM
that was it, thanks....just updated that repo (PeopleInSpace) with that change and those version updates
One difference between this repo and the BikeShare one (where I'm seeing that crash) is that BikeShare is using Koin in Compose code....not sure if that needs to be updated as a result of alpha07 update
j

jaqxues

11/11/2020, 9:00 PM
I can't easily reproduce the issue, it is pretty complex The issue happens after toggling this Switch. If I comment out both Icons, it does not crash.
l

Leland Richardson [G]

11/11/2020, 9:41 PM
Can you put this in a bug? Code to repro starting from empty template or something would be great
j

jaqxues

11/11/2020, 10:43 PM
The architecture is pretty complex, as follows: ViewModel with LiveData<List<Elements>> These elements have a state, so for each Element I have an individual livedata for its state Now when the switch changes, the individual state updates and since that is observed as state, it should fire off recomposition. The issue itself seems to come from the IconButton, more specifically the rememberInteractionState(). That is probably the slot element that dpesnt have a parent anchor (or whatever the reason is). I have not figured out why yet, and as stated above the issue is not really very easily reproducible. I'll try to put a reproduction sample together, but I already tried just the composables and I think the LiveData architecture might be a factor in this, or even the exact composable hierarchy. I just haven't been able to get it to fail like in the actual Project
l

Leland Richardson [G]

11/11/2020, 11:42 PM
gotcha. and the project isn’t open source, correct?
@Chuck Jazdzewski [G] might be able to infer the issue from the full stack trace, i’m not sure though
j

jaqxues

11/12/2020, 12:25 PM
I use AnimatedVisibility in my Code, seems like that is the issue. Removing that part and having the view "expanded" (with full content at all time), it works fine
l

Leland Richardson [G]

11/12/2020, 5:55 PM
do you have an example of the before/after that produces the error? This is very likely an underlying bug in the new slot table implementation that animated visibility just seems to be triggering
j

jaqxues

11/12/2020, 6:00 PM
What do you mean before/after? I just replaced
AnimatedVisibility(isExpanded, content=content)
with
if (isExpanded) content()
l

Leland Richardson [G]

11/12/2020, 6:28 PM
that is what i mean, just a more complete example to repro if possible?
j

jaqxues

11/12/2020, 6:36 PM
As I said i could not reproduce it, even by copying the entire screen and exchanging my data objects with just strings etc
v

Vincent tiensi

11/18/2020, 5:55 AM
Also getting
Invalid slot table detected
as well but with a different complex implementation, will try to see if we can narrow down
j

jaqxues

11/19/2020, 2:13 AM
@Vincent tiensi wouldnt recommend trying to narrow it down. They just need to be able to reproduce your issue. And since i know how this bug is very complex, i suppose its easiest to share the project with them if you can
v

Vincent tiensi

11/19/2020, 2:14 AM
Ah yeah that’s what I meant, by making the code bit smaller so that they can debug more closely, we inadvertently fixed it by changing this
Copy code
val state = unwrappedState.value ?: return@Box
to this
Copy code
when (val state = unwrappedState.value){
//continue
l

Leland Richardson [G]

11/19/2020, 5:41 AM
interesting. the early return in the RHS of the nullary expression is probably the culprit here. Is there a bigger view of this function that you can provide me?
j

jaqxues

12/02/2020, 10:15 PM
I do not know if there were updates to it, but alpha08 fixed it.