mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[github] Fix pull request loader
Initial indicator was reusable, so loader could load more than needed
This commit is contained in:
+9
-7
@@ -27,7 +27,7 @@ class GithubPullRequestsLoader(private val progressManager: ProgressManager,
|
||||
private val LOG = logger<GithubPullRequestsLoader>()
|
||||
|
||||
private val executor = AppExecutorUtil.createBoundedApplicationPoolExecutor("GitHub PR loading breaker", 1)
|
||||
private var progressIndicator = EmptyProgressIndicator()
|
||||
private var progressIndicator = createNonReusableIndicator()
|
||||
private var query: String = buildQuery(null)
|
||||
private var nextPageRequest: GithubApiRequest<GithubResponsePage<GithubSearchedIssue>>? = createInitialRequest()
|
||||
private var isDisposed = false
|
||||
@@ -111,12 +111,7 @@ class GithubPullRequestsLoader(private val progressManager: ProgressManager,
|
||||
fun reset() {
|
||||
if (isDisposed) return
|
||||
progressIndicator.cancel()
|
||||
progressIndicator = object : EmptyProgressIndicator() {
|
||||
override fun start() {
|
||||
checkCanceled()
|
||||
super.start()
|
||||
}
|
||||
}
|
||||
progressIndicator = createNonReusableIndicator()
|
||||
executor.execute {
|
||||
nextPageRequest = createInitialRequest()
|
||||
stateEventDispatcher.multicaster.loaderReset()
|
||||
@@ -124,6 +119,13 @@ class GithubPullRequestsLoader(private val progressManager: ProgressManager,
|
||||
}
|
||||
}
|
||||
|
||||
private fun createNonReusableIndicator(): ProgressIndicator = object : EmptyProgressIndicator() {
|
||||
override fun start() {
|
||||
checkCanceled()
|
||||
super.start()
|
||||
}
|
||||
}
|
||||
|
||||
fun addStateListener(listener: StateListener, disposable: Disposable) = stateEventDispatcher.addListener(listener, disposable)
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
Reference in New Issue
Block a user