You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(currentLength): replace itemsLength with more explicit currentLength prop name
Warns when using itemsLength instead of currentLength.
Some users had difficulties with the meaning of the former prop name and
interpreted it as totalLength which led them to misuse the component's awaitMore prop.
@@ -85,7 +85,7 @@ Provided an `itemsRenderer` prop you must attach the `ref` argument to your scro
85
85
86
86
This element specifies `overflow: auto|scroll` and it'll become the `IntersectionObserver root`. If the `overflow` property isn't found, then `window` will be used as the `root` instead.
87
87
88
-
The `<sentinel />` element is by default detached from the list when the current size reaches the available length, unless you're using `awaitMore`. In case your list is in memory and you rely on the list for incremental rendering only, the default detaching behavior suffices. If you're loading items asynchoronously on-demand, make sure to switch `awaitMore` once you reach the total `itemsLength`.
88
+
The `<sentinel />` element is by default detached from the list when the current size reaches the available length, unless you're using `awaitMore`. In case your list is in memory and you rely on the list for incremental rendering only, the default detaching behavior suffices. If you're loading items asynchoronously on-demand, make sure to switch `awaitMore` once you reach the total length.
89
89
90
90
### FAQ
91
91
@@ -113,7 +113,7 @@ The prop `pageSize` is `10` by default, so make sure you're not falling short on
Copy file name to clipboardExpand all lines: docs/recipes/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
### Asynchonous Repo List
4
4
5
-
When the sentinel comes into view, you can use the callback to load data, create the next items, and attach them. For this case we're loading Github repositories with pagination. We assume that we don't know the total `itemsLength` and we'll want to keep fetching until the (unknown) end of the list. The solution here is to pass the prop `awaitMore:bool = true`, so that the sentinel awaits for more items.
5
+
When the sentinel comes into view, you can use the callback to load data, create the next items, and attach them. For this case we're loading Github repositories with pagination. We assume that we don't know the total length and we'll want to keep fetching until the (unknown) end of the list. The solution here is to pass the prop `awaitMore:bool = true`, so that the sentinel awaits for more items.
6
6
7
7
```jsx
8
8
importReactfrom'react';
@@ -67,7 +67,7 @@ export default class extends React.Component {
67
67
<List
68
68
awaitMore={this.state.awaitMore}
69
69
itemsRenderer={this.renderItems}
70
-
itemsLength={this.state.repos.length}
70
+
currentLength={this.state.repos.length}
71
71
onIntersection={this.handleLoadMore}
72
72
pageSize={PAGE_SIZE}
73
73
>
@@ -79,7 +79,7 @@ export default class extends React.Component {
79
79
}
80
80
```
81
81
82
-
If it's possible to get the total `itemsLength` in advance, we won't need `awaitMore` and the `pageSize` will be used to paginate results until we reach the bottom of the list.
82
+
If the total amount of items are prefetched and available, we won't need `awaitMore` and the `pageSize` will be used to paginate results until we reach the bottom of the list.
'The sentinel detected a viewport with a bigger size than the size of its items. This could lead to detrimental behavior, e.g.: triggering more than one `onIntersection` callback at the start.\n'+
57
-
'To prevent this, use either a bigger `pageSize` value or avoid using the prop `awaitMore` initially.',
64
+
'the sentinel detected a viewport with a bigger size than the size of its items. '+
65
+
'This could lead to detrimental behavior, e.g.: triggering more than one onIntersection callback at the start.\n'+
66
+
'To prevent this, use either a bigger `pageSize` value or avoid using the prop awaitMore initially.',
exports[`handleUpdate throws once if sentinel intersects items on mount 1`] =`
4
-
"Warning: The sentinel detected a viewport with a bigger size than the size of its items. This could lead to detrimental behavior, e.g.: triggering more than one \`onIntersection\` callback at the start.
5
-
To prevent this, use either a bigger \`pageSize\` value or avoid using the prop \`awaitMore\` initially."
4
+
"Warning: the sentinel detected a viewport with a bigger size than the size of its items. This could lead to detrimental behavior, e.g.: triggering more than one onIntersection callback at the start.
5
+
To prevent this, use either a bigger \`pageSize\` value or avoid using the prop awaitMore initially."
0 commit comments