From 8484a4a2a4eeafb9f56948e3ab05d2239970e508 Mon Sep 17 00:00:00 2001 From: ysliu Date: Sun, 18 Sep 2016 14:11:04 +0800 Subject: [PATCH] remove the maxNumber checking --- .../src/webparts/todo-step-2/TodoWebPart.tsx | 33 +++++++------------ .../src/webparts/todo-step-3/TodoWebPart.tsx | 33 +++++++------------ .../src/webparts/todo-step-4/TodoWebPart.tsx | 33 +++++++------------ 3 files changed, 36 insertions(+), 63 deletions(-) diff --git a/samples/todo-webpart-sample/src/webparts/todo-step-2/TodoWebPart.tsx b/samples/todo-webpart-sample/src/webparts/todo-step-2/TodoWebPart.tsx index 3754feb86..7b5b62266 100644 --- a/samples/todo-webpart-sample/src/webparts/todo-step-2/TodoWebPart.tsx +++ b/samples/todo-webpart-sample/src/webparts/todo-step-2/TodoWebPart.tsx @@ -173,28 +173,19 @@ export default class TodoWebPart extends BaseClientSideWebPart { this.clearError(); + this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - if (this._dataProvider.maxNumberOfTasks > this._todoComponentData.selectedListItems.length) { - this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - - return this._dataProvider.readItems() - .then( - (items: ITodoTask[]) => items && this._renderTodoComponent({ - selectedListItems: items, - loadingStatus: LoadingStatus.None - }), - (error: Error) => { - this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); - this.renderError(error); - } - ); - } else { - this._renderTodoComponent({ - selectedListItems: this._todoComponentData.selectedListItems.slice(0, this._dataProvider.maxNumberOfTasks) - }); - - return Promise.resolve(undefined); - } + return this._dataProvider.readItems() + .then( + (items: ITodoTask[]) => items && this._renderTodoComponent({ + selectedListItems: items, + loadingStatus: LoadingStatus.None + }), + (error: Error) => { + this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); + this.renderError(error); + } + ); } /** diff --git a/samples/todo-webpart-sample/src/webparts/todo-step-3/TodoWebPart.tsx b/samples/todo-webpart-sample/src/webparts/todo-step-3/TodoWebPart.tsx index 3413ce750..c79412204 100644 --- a/samples/todo-webpart-sample/src/webparts/todo-step-3/TodoWebPart.tsx +++ b/samples/todo-webpart-sample/src/webparts/todo-step-3/TodoWebPart.tsx @@ -316,28 +316,19 @@ export default class TodoWebPart extends BaseClientSideWebPart { this.clearError(); + this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - if (this._dataProvider.maxNumberOfTasks > this._todoComponentData.selectedListItems.length) { - this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - - return this._dataProvider.readItems() - .then( - (items: ITodoTask[]) => items && this._renderTodoComponent({ - selectedListItems: items, - loadingStatus: LoadingStatus.None - }), - (error: Error) => { - this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); - this.renderError(error); - } - ); - } else { - this._renderTodoComponent({ - selectedListItems: this._todoComponentData.selectedListItems.slice(0, this._dataProvider.maxNumberOfTasks) - }); - - return Promise.resolve(undefined); - } + return this._dataProvider.readItems() + .then( + (items: ITodoTask[]) => items && this._renderTodoComponent({ + selectedListItems: items, + loadingStatus: LoadingStatus.None + }), + (error: Error) => { + this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); + this.renderError(error); + } + ); } /** diff --git a/samples/todo-webpart-sample/src/webparts/todo-step-4/TodoWebPart.tsx b/samples/todo-webpart-sample/src/webparts/todo-step-4/TodoWebPart.tsx index 45fcf3b4d..465a7d0a2 100644 --- a/samples/todo-webpart-sample/src/webparts/todo-step-4/TodoWebPart.tsx +++ b/samples/todo-webpart-sample/src/webparts/todo-step-4/TodoWebPart.tsx @@ -316,28 +316,19 @@ export default class TodoWebPart extends BaseClientSideWebPart { this.clearError(); + this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - if (this._dataProvider.maxNumberOfTasks > this._todoComponentData.selectedListItems.length) { - this._renderTodoComponent({ loadingStatus: LoadingStatus.FetchingTasks }); - - return this._dataProvider.readItems() - .then( - (items: ITodoTask[]) => items && this._renderTodoComponent({ - selectedListItems: items, - loadingStatus: LoadingStatus.None - }), - (error: Error) => { - this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); - this.renderError(error); - } - ); - } else { - this._renderTodoComponent({ - selectedListItems: this._todoComponentData.selectedListItems.slice(0, this._dataProvider.maxNumberOfTasks) - }); - - return Promise.resolve(undefined); - } + return this._dataProvider.readItems() + .then( + (items: ITodoTask[]) => items && this._renderTodoComponent({ + selectedListItems: items, + loadingStatus: LoadingStatus.None + }), + (error: Error) => { + this._renderTodoComponent({ loadingStatus: LoadingStatus.None }); + this.renderError(error); + } + ); } /**