Skip to content

Commit 511d9f0

Browse files
committed
refactor: create prop array as needed
1 parent 3c39bc8 commit 511d9f0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/qwik/src/core/client/vnode.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,9 @@ export const vnode_getPropStartIndex = (vnode: VNode): number => {
17701770

17711771
/** @internal */
17721772
export const vnode_getProps = (vnode: VNode): unknown[] => {
1773-
return vnode[vnode_getPropStartIndex(vnode)] as unknown[];
1773+
const propsIndex = vnode_getPropStartIndex(vnode);
1774+
const props = vnode[propsIndex];
1775+
return !props ? (vnode[propsIndex] = []) : (vnode[propsIndex] as unknown[]);
17741776
};
17751777

17761778
export const vnode_getParent = (vnode: VNode): VNode | null => {
@@ -2135,7 +2137,7 @@ const VNodeArray = class VNode extends Array<any> {
21352137
lastChild,
21362138
element,
21372139
elementName,
2138-
[]
2140+
undefined
21392141
) as ElementVNode;
21402142
}
21412143

@@ -2165,7 +2167,7 @@ const VNodeArray = class VNode extends Array<any> {
21652167
nextSibling,
21662168
firstChild,
21672169
lastChild,
2168-
[]
2170+
undefined
21692171
) as VirtualVNode;
21702172
}
21712173

0 commit comments

Comments
 (0)