airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.51k stars 728 forks source link

why EpoxyController#requestModelBuild blocks main thread more than 100ms #1248

Open yyj001 opened 2 years ago

yyj001 commented 2 years ago

I have a recyclerView in a popUp View, I generate the recyclerView when the popUp View is showing. but epoxy model build will blocks the main thread and blocks my animation. when I try to use AsyncEpoxyController, i found model building still works in main thread, and blocks main thread more than 100ms.

if hasBuiltModelsEver != true, requestModelBuild() will invoke buildModelsRunnable.run() directly. we can not control it run in other thread. but if hasBuiltModelsEver == true, requestModelBuild will invoke requestDelayedModelBuild(0), it will invoke modelBuildHandler.postDelayed() and works in 'epoxy' thread. I think it's a bug. I can use requestDelayedModelBuild to avoid it. if I want to use PagingDataEpoxyController, how can I control model building work in "epoxy" thread when recyclerView generate at first time?