Marko Savic
10/18/2023, 1:26 PMPaging3
library into our Article comments UI - with Jetpack Compose
collectAsLazyPagingItems()
support and we also have implemented jetpack compose navigation
( from comments page to comments thread page. )
Issue that now we have is that when animation navigation happens it triggers API call couple of times during animation and I don't know why that happens!!! 😢
Issue is similar to this one: https://stackoverflow.com/questions/71410790/paging-3-list-auto-refresh-on-navigation-back-in-jetpack-compose-navigation
and I have tried saving the instance of Pager but that didn't help 😢
Of course I am using:
flow.cachedIn(viewModelScope)
and Paging3Version is 3.2.0
Btw, I didn't have a luck to find any complex example like in my case where you have Paging3 + JetpackCompose + navigation
Also we have Tabs there but it's another part of story.
Does anyone has experience around this problem? thank you color
🙇Ian Lake
10/18/2023, 1:59 PMit triggers APl call couple of times during animation
This sounds like you are doing something as part of composition (as it is expected that your screen recomposes multiple times during an animation), but you shouldn't ever be triggering anything API call related as part of composition or as part of an Effect really - Paging automatically refreshed when your PagingSource invalidates itself
Marko Savic
10/18/2023, 2:05 PM<--- ANIMTION start --->
enterTransition Blue
exitTransition Red
enterTransition Blue
exitTransition Red
<--- ANIMTION end --->
<--- UI load --->
Render Blue
<--- ANIMTION start --->
enterTransition Blue
exitTransition Red
<--- ANIMTION end --->
<--- UI load --->
Render Red
<--- API CALL --->
load load load
<--- UI load --->
Render Blue
<--- API CALL --->
load load load
Did ViewModel clears cache somehow?
Does load method calls for not reason?
Thanks! 🙏 🙇Ian Lake
10/23/2023, 9:39 PMval
, not a fun get
Marko Savic
10/23/2023, 9:41 PMIan Lake
10/23/2023, 10:18 PMMarko Savic
10/24/2023, 12:06 AM