Commit a3b898e
committed
only resolve the next set of containers when needed
This is just a very very small optimization, but wanted to optimize it
since I noticed it.
Essentially `containers.flatMap(resolve => resolve())` is a bit wasteful
if we you have `n` containers, but you already found a match in the
first container.
If that's the case, then we resolved `n-1` containers for nothing.
Depending on what we actually do during this resolve step it could be
a lot of unnecessary work (e.g.: querying the DOM).1 parent 98113b6 commit a3b898e
File tree
1 file changed
+9
-3
lines changed- packages/@headlessui-react/src/hooks/document-overflow
1 file changed
+9
-3
lines changedLines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
0 commit comments