From 05d88e9eaa53506e66fc6f838bea2af7a7a24065 Mon Sep 17 00:00:00 2001 From: Yimin Wu Date: Thu, 28 Jul 2016 09:05:12 -0700 Subject: [PATCH] Fix infinity loop when this.props.getItemCountForPage return 0 as item count per page. --- src/components/List/List.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index 8f9bb56663694..56bcf09e689c1 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -569,7 +569,9 @@ export class List extends BaseComponent { } private _getItemCountForPage(itemIndex: number, visibileRect: ClientRect): number { - return this.props.getItemCountForPage ? this.props.getItemCountForPage(itemIndex, visibileRect) : DEFAULT_ITEMS_PER_PAGE; + let itemsPerPage = this.props.getItemCountForPage ? this.props.getItemCountForPage(itemIndex, visibileRect) : DEFAULT_ITEMS_PER_PAGE; + + return itemsPerPage ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; } private _createPage(pageKey: string, items: any[], startIndex?: number, count?: number, style?: any): IPage {