Skip to content

Commit 7a7df31

Browse files
committed
[MainView] Only Provide Initial Data Source Once
1 parent 1f74c80 commit 7a7df31

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SwiftFlowGitHubBrowser/ViewControllers/MainViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class MainViewController: UIViewController, StoreSubscriber {
3535
}
3636

3737
store.dispatch(fetchGitHubRepositories)
38-
self.dataSource = ArrayDataSource(array: [], cellType: RepositoryTableViewCell.self)
38+
39+
if self.dataSource == nil {
40+
// If we have no intial data, let's configure it.
41+
self.dataSource = ArrayDataSource(array: [], cellType: RepositoryTableViewCell.self)
42+
}
43+
3944
tableView.dataSource = dataSource
4045
tableView.delegate = self
4146
}

0 commit comments

Comments
 (0)