@@ -82,9 +82,7 @@ define(function (require, exports, module) {
8282 var $dlg = $ ( ".about-dialog.instance" ) ,
8383 $contributors = $dlg . find ( ".about-contributors" ) ,
8484 $spinner = $dlg . find ( ".spinner" ) ,
85- allContributors = [ ] ,
8685 contributorsUrl = brackets . config . contributors_url ,
87- data ,
8886 page ;
8987
9088 if ( contributorsUrl . indexOf ( "{1}" ) !== - 1 ) { // pagination enabled
@@ -94,31 +92,31 @@ define(function (require, exports, module) {
9492 $spinner . addClass ( "spin" ) ;
9593
9694 function loadContributors ( rawUrl , page , contributors , deferred ) {
97- deferred = deferred || $ . Deferred ( ) ;
95+ deferred = deferred || new $ . Deferred ( ) ;
9896 contributors = contributors || [ ] ;
99- var url = rawUrl ;
100- if ( page ) {
101- url = StringUtils . format ( rawUrl , CONTRIBUTORS_PER_PAGE , page ) ;
102- }
97+ var url = StringUtils . format ( rawUrl , CONTRIBUTORS_PER_PAGE , page ) ;
10398
10499 $ . ajax ( {
105100 url : url ,
106101 dataType : "json" ,
107102 cache : false
108103 } )
109104 . done ( function ( response ) {
110- var data = response || [ ] ;
111- contributors = contributors . concat ( data ) ;
112- if ( page && data . length === CONTRIBUTORS_PER_PAGE ) {
105+ contributors = contributors . concat ( response || [ ] ) ;
106+ if ( page && response . length === CONTRIBUTORS_PER_PAGE ) {
113107 loadContributors ( rawUrl , page + 1 , contributors , deferred ) ;
114108 } else {
115109 deferred . resolve ( contributors ) ;
116110 }
117111 } )
118112 . fail ( function ( ) {
119- deferred . reject ( contributors ) ;
113+ if ( contributors . length ) { // we weren't able to fetch this page, but previous fetches were successful
114+ deferred . resolve ( contributors ) ;
115+ } else {
116+ deferred . reject ( ) ;
117+ }
120118 } ) ;
121- return deferred ;
119+ return deferred . promise ( ) ;
122120 }
123121
124122 loadContributors ( contributorsUrl , page ) // Load the contributors
0 commit comments