Increased refresh time when having multiple consecutive changes to 1s and added refresh when diff missing

This commit is contained in:
Abdelilah El Aissaoui 2022-04-07 22:50:52 +02:00
parent c20021832f
commit 7b4ab49a30
3 changed files with 6 additions and 1 deletions

View File

@ -134,6 +134,10 @@ class TabState @Inject constructor(
}
}
suspend fun refreshData(refreshType: RefreshType) {
_refreshData.emit(refreshType)
}
fun newSelectedStash(stash: RevCommit) {
newSelectedItem(SelectedItem.Stash(stash))
}

View File

@ -54,6 +54,7 @@ class DiffViewModel @Inject constructor(
_diffResult.value = ViewDiffResult.Loaded(diffEntryType, diffFormat)
} catch (ex: Exception) {
if(ex is MissingDiffEntryException) {
tabState.refreshData(refreshType = RefreshType.UNCOMMITED_CHANGES)
_diffResult.value = ViewDiffResult.DiffNotFound
} else
ex.printStackTrace()

View File

@ -20,7 +20,7 @@ import org.eclipse.jgit.lib.RepositoryState
import java.io.File
import javax.inject.Inject
private const val MIN_TIME_IN_MS_BETWEEN_REFRESHES = 500L
private const val MIN_TIME_IN_MS_BETWEEN_REFRESHES = 1000L
/**
* Contains all the information related to a tab and its subcomponents (smaller composables like the log, branches,