From 69dac70e6b6acb196003569d6ad765d9ffbfdb7b Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Thu, 30 Jan 2020 20:33:52 +0300 Subject: [PATCH] [github] Fix changes loading panel selection GitOrigin-RevId: df24ea1324de3b5e3864ad7346695346c9a74b38 --- .../ui/changes/GHPRChangesLoadingModel.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/changes/GHPRChangesLoadingModel.kt b/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/changes/GHPRChangesLoadingModel.kt index c67319167dac..685cf1ab79dd 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/changes/GHPRChangesLoadingModel.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/changes/GHPRChangesLoadingModel.kt @@ -1,10 +1,9 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.github.pullrequest.ui.changes import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider import org.jetbrains.plugins.github.pullrequest.ui.GHEventDispatcherLoadingModel import org.jetbrains.plugins.github.util.handleOnEdt -import org.jetbrains.plugins.github.util.successOnEdt import java.util.concurrent.CompletableFuture import kotlin.properties.Delegates @@ -57,15 +56,14 @@ class GHPRChangesLoadingModel(private val changesModel: GHPRChangesModel, loading = true error = null - updateFuture = dataProvider.changesProviderRequest.successOnEdt { + updateFuture = dataProvider.changesProviderRequest.handleOnEdt { result, error -> - if (zipChanges) changesModel.changes = it.changes - else changesModel.commits = it.changesByCommits - - diffHelper.setUp(dataProvider, it) - - }.handleOnEdt { _, error: Throwable? -> + if (result != null) { + if (zipChanges) changesModel.changes = result.changes + else changesModel.commits = result.changesByCommits + diffHelper.setUp(dataProvider, result) + } if (error != null) this.error = error loading = false eventDispatcher.multicaster.onLoadingCompleted()