We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0768b8 commit 8e3b666Copy full SHA for 8e3b666
src/util/vnode.ts
@@ -6,10 +6,10 @@ export function collectNodes<T>(
6
clear = false
7
): VNode<T>[] {
8
const collected: VNode<T>[] = [];
9
- if (!tree) {
+ const children = tree?.props?.children;
10
+ if (!children) {
11
return collected;
12
}
- const children = tree.props.children;
13
if (!Array.isArray(children)) {
14
const child = children as VNode<T>;
15
if (filter(children as VNode<T>)) {
@@ -19,7 +19,7 @@ export function collectNodes<T>(
19
20
21
} else {
22
- for (const [i, child] of (children as VNode<T>[]).entries()) {
+ for (const [i, child] of Array.from((children as VNode<T>[]).entries())) {
23
if (filter(child)) {
24
collected.push(child);
25
if (clear) {
0 commit comments