-
-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathasync.js
More file actions
41 lines (36 loc) · 764 Bytes
/
async.js
File metadata and controls
41 lines (36 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { h } from 'preact';
import { lazy } from 'preact/compat';
function Leaf() {
return (
<div>
<span class="foo" data-testid="stack">
deep stack
</span>
</div>
);
}
// oxlint-disable-next-line no-new-array
const lazies = new Array(600).fill(600).map(() =>
lazy(() =>
Promise.resolve().then(() => ({
default: (props) => <div>{props.children}</div>
}))
)
);
function PassThrough(props) {
const Lazy = lazies(props.id);
return <Lazy {...props} />;
}
function recursive(n, m) {
if (n <= 0) {
return <Leaf />;
}
return <PassThrough id={n * m}>{recursive(n - 1)}</PassThrough>;
}
const content = [];
for (let i = 0; i < 5; i++) {
content.push(recursive(10, i));
}
export default function App() {
return <div>{content}</div>;
}