Skip to content

Commit b4affc2

Browse files
committed
as per review - add fail handler and simplify result checker
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 0b1afca commit b4affc2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

web_src/js/features/repo-diff.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ export function initRepoDiffShowMore() {
9494
type: 'GET',
9595
url,
9696
}).done((resp) => {
97-
if (!resp || resp.html === '' || resp.empty) {
97+
if (!resp) {
9898
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
9999
return;
100100
}
101101
$('#diff-too-many-files-stats').remove();
102102
$('#diff-files').append($(resp).find('#diff-files li'));
103103
$('#diff-incomplete').replaceWith($(resp).find('#diff-file-boxes').children());
104+
}).fail(() => {
105+
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
104106
});
105107
});
106108
$(document).on('click', 'a.diff-show-more-button', (e) => {
@@ -118,12 +120,14 @@ export function initRepoDiffShowMore() {
118120
type: 'GET',
119121
url,
120122
}).done((resp) => {
121-
if (!resp || resp.html === '' || resp.empty) {
123+
if (!resp) {
122124
$target.removeClass('disabled');
123125
return;
124126
}
125127

126128
$target.parent().replaceWith($(resp).find('#diff-file-boxes .diff-file-body .file-body').children());
129+
}).fail(() => {
130+
$target.removeClass('disabled');
127131
});
128132
});
129133
}

0 commit comments

Comments
 (0)