The error is printed in the logs when you navigate...
# decompose
a
The error is printed in the logs when you navigate or init your navigation on a non-main thread. There should be a stack trace pointing to the offending code.
v
it pointed to this function
a
Yes, but there should also be a trace to the place where that function was called, and so on. It would be helpful if you could post the entire stack trace.
v
Sorry for the delay I found out the issue I was calling navigate from a flow which was on IO dispatcher
Btw is it possible for decompose to change dispatcher internally or an interceptor or something in which i can switch to Main thread?
a
Thanks for the update! Currently there is no way to switch threads automatically. But I will think about it, thanks again.
v
If i by mistake navigate on a non main thread Will app crash or is it just a warning printed in logs?
a
It's just an error in the logs, not a crash.
You can attach your own interceptor via onDecomposeError gollobal callback and crash the app, or report to an analytics service of your choice.
v
Ahh i see I wanted that interceptor to intercept all nav events and move it to main thread
a
Yeah, automatic thread switching is not possible right now. This has to be carefully thought through before implementing, as there might be implications.
v
Ohh i see Hoping to see it in future Decompose release
👍 1