@@ -41,11 +41,10 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
4141
4242 this . _selection = null ;
4343
44-
4544 this . state = {
4645 isLoading : true ,
4746 results : [ ] ,
48- filePickerResults : [ ]
47+ filePickerResults : [ ] ,
4948 } ;
5049 }
5150
@@ -123,11 +122,16 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
123122 */
124123 private _getItemCountForPage = ( itemIndex : number , surfaceRect : IRectangle ) : number => {
125124 if ( itemIndex === 0 ) {
126- this . _columnCount = Math . ceil ( surfaceRect . width / MAX_ROW_HEIGHT ) ;
127- this . _columnWidth = Math . floor ( surfaceRect . width / this . _columnCount ) ;
128- this . _rowHeight = this . _columnWidth ;
125+ if ( surfaceRect . width === 0 ) {
126+ //surfaceRect.width is 0 on load of this component, passing some default values so it renders.
127+ this . _columnCount = 9 ;
128+ this . _columnWidth = 161 ;
129+ } else {
130+ this . _columnCount = Math . ceil ( surfaceRect . width / MAX_ROW_HEIGHT ) ;
131+ this . _columnWidth = Math . floor ( surfaceRect . width / this . _columnCount ) ;
132+ }
133+ this . _rowHeight = this . _columnWidth ;
129134 }
130-
131135 return this . _columnCount * ROWS_PER_PAGE ;
132136 }
133137
@@ -157,7 +161,7 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
157161 /**
158162 * Renders a grid list containing results
159163 */
160- private _renderGridList = ( ) : JSX . Element => {
164+ private _renderGridList = ( ) : JSX . Element => {
161165 return < span className = { styles . recentGridList } role = "grid" >
162166 < FocusZone >
163167 < SelectionZone selection = { this . _selection }
@@ -168,9 +172,9 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
168172 < List
169173 ref = { this . _linkElement }
170174 items = { this . state . results }
171- onRenderCell = { this . _onRenderCell }
175+ onRenderCell = { this . _onRenderCell }
172176 getItemCountForPage = { this . _getItemCountForPage }
173- getPageHeight = { this . _getPageHeight }
177+ getPageHeight = { this . _getPageHeight }
174178 renderedWindowsAhead = { 4 }
175179 />
176180 </ SelectionZone >
0 commit comments