Skip to content

Commit

Permalink
[REFACT] Fix Unexpected Infinite Loading of Top Three Notices
Browse files Browse the repository at this point in the history
  - Resolve identified problem: some of categories in main page fell into infinite loading.
   * Add slight delay before validate local data saved in NoticeLocalRepository.
  • Loading branch information
doyoonkim3312 committed Oct 15, 2024
1 parent 7c1a131 commit ed4d278
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.doyoonkim.knutice.model.TopThreeNotices
import dagger.hilt.android.scopes.ActivityRetainedScoped
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.flow.flow
Expand All @@ -33,6 +34,7 @@ class NoticeLocalRepository @Inject constructor(
}.flowOn(Dispatchers.IO)
} else {
return flow<TopThreeNotices> {
delay(10L)
if (localData?.result?.resultCode == 200) {
emit(localData!!)
} else {
Expand Down

0 comments on commit ed4d278

Please sign in to comment.