I just ran into a crash where I was updating a val...
# decompose
a
I just ran into a crash where I was updating a value class off the main thread. my fault of course. but it got me thinking that it would be nice to have a main thread check that crashes you. I realize that's a bit harder in a multi-platform world, but still might be worth thinking about? build it into getAndUpdate
a
Are you talking about Value?
a
yeah
a
Well, the implementations of Value and MutableValue provided by Decompose are thread-safe. It's like Flow. Perhaps, you are getting errors on SwiftUI? You could write your own
mutableValue(...)
builder function that would subscribe to the
MutableValue
being returned and perform main thread checks.
a
it was a compose multi-platform crash
after upgrading to 1.5.0
it seems to have gotten pickier
only on Android though, the same code doesn't crash on desktop
a
I'm curious to see a stack trace
a
I have it fixed now by doing a width context main dispatcher, but I can easily reproduce it tonight and get you a stack
👍 1