Related Changes: Discard late arriving REST API results
Users can load CS2 and open a file before Related Changes is able to finish its REST API calls and load the panel. If this happens the tab will be detached from the DOM and cannot measure its correct height, resulting in CSS failures with "CSS heights should not be negative". Discard REST results if the widget is no longer attached to the DOM, as the user has navigated away and does not care anymore. Change-Id: Iad8303879019570edc67192956d32d7eddb9926e
This commit is contained in:
parent
c09bad2917
commit
d9d64ecd6a
@ -272,19 +272,23 @@ public class RelatedChanges extends TabPanel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(T result) {
|
public void onSuccess(T result) {
|
||||||
JsArray<ChangeAndCommit> changes = convert(result);
|
if (isAttached()) {
|
||||||
if (changes.length() > 0) {
|
JsArray<ChangeAndCommit> changes = convert(result);
|
||||||
setTabTitle(tabInfo, tabInfo.getTitle(changes.length()));
|
if (changes.length() > 0) {
|
||||||
getTab(tabInfo).setChanges(project, revision, changes);
|
setTabTitle(tabInfo, tabInfo.getTitle(changes.length()));
|
||||||
|
getTab(tabInfo).setChanges(project, revision, changes);
|
||||||
|
}
|
||||||
|
onDone(changes.length() > 0);
|
||||||
}
|
}
|
||||||
onDone(changes.length() > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable err) {
|
public void onFailure(Throwable err) {
|
||||||
setTabTitle(tabInfo, tabInfo.getTitle(Resources.C.notAvailable()));
|
if (isAttached()) {
|
||||||
getTab(tabInfo).setError(err.getMessage());
|
setTabTitle(tabInfo, tabInfo.getTitle(Resources.C.notAvailable()));
|
||||||
onDone(true);
|
getTab(tabInfo).setError(err.getMessage());
|
||||||
|
onDone(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDone(boolean enabled) {
|
private void onDone(boolean enabled) {
|
||||||
|
Loading…
Reference in New Issue
Block a user