Repository navigation
Commit b65f25b
committed
docs: drop void and async from the InfiniteList recipe
`void` was there to quiet a floating-promise lint rule, and `async` promised a
result nobody awaits. `loadMore` now starts the request and returns nothing,
so the observer calls `loadMore()` and the button takes `onClick={loadMore}`
directly.
The two-argument `.then` is deliberate. `.catch` after it would also swallow a
bug thrown by the state updates in the success path and report it to the user
as a failed request.
Same slop in the lazy-loading section I added two commits ago, caught while
looking: LazyTile reported visibility to its parent through a useEffect on
`inView`, which is the effect the recipe rewrite just removed. It uses
`onChange` now. That fires exactly once under `triggerOnce`, so the parent
counts with a number instead of an id array with an includes() dedupe guard,
and the useCallback around it goes too.
Verified against the browser's own observer, since the docs preview pane was
hidden and a hidden page delivers no intersections at all: the recipe still
passes all seven cases, and the tiles start deferred with no img in the DOM,
count to exactly six on scroll, and do not double-count when scrolled away
and back.1 parent a114253 commit b65f25b
3 files changed
Lines changed: 25 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
548 | | - | |
| 547 | + | |
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
| |||
570 | 569 | | |
571 | 570 | | |
572 | 571 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 572 | + | |
577 | 573 | | |
578 | 574 | | |
579 | 575 | | |
| |||
593 | 589 | | |
594 | 590 | | |
595 | 591 | | |
596 | | - | |
| 592 | + | |
597 | 593 | | |
598 | 594 | | |
599 | 595 | | |
| |||
602 | 598 | | |
603 | 599 | | |
604 | 600 | | |
605 | | - | |
| 601 | + | |
606 | 602 | | |
607 | 603 | | |
608 | 604 | | |
| |||
651 | 647 | | |
652 | 648 | | |
653 | 649 | | |
654 | | - | |
| 650 | + | |
655 | 651 | | |
656 | 652 | | |
657 | 653 | | |
658 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
659 | 658 | | |
660 | 659 | | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | 660 | | |
666 | 661 | | |
667 | 662 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | | - | |
1018 | | - | |
| 1017 | + | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
| 1102 | + | |
| 1103 | + | |
1105 | 1104 | | |
1106 | 1105 | | |
1107 | 1106 | | |
| |||
0 commit comments