Skip to content

Commit 8a2f1c4

Browse files
committed
Fix double addtion of react elements on scroll
(cherry picked from commit d213a44)
1 parent 4609de4 commit 8a2f1c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/internal-packages/crud/lib/component/document-list.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class DocumentList extends React.Component {
6969
*/
7070
constructor(props) {
7171
super(props);
72+
this.loading = false;
7273
this.state = { docs: [], nextSkip: 0, namespace: NamespaceStore.ns };
7374
}
7475

@@ -86,6 +87,7 @@ class DocumentList extends React.Component {
8687
nextSkip: (this.state.nextSkip + documents.length),
8788
loadedCount: (this.state.loadedCount + documents.length)
8889
});
90+
this.loading = false;
8991
}
9092

9193
/**
@@ -166,7 +168,8 @@ class DocumentList extends React.Component {
166168
* in the collection to load.
167169
*/
168170
loadMore() {
169-
if (this.state.loadedCount < this.state.count) {
171+
if (!this.loading && (this.state.loadedCount < this.state.count)) {
172+
this.loading = true;
170173
Action.fetchNextDocuments(this.state.nextSkip);
171174
}
172175
}

0 commit comments

Comments
 (0)