Skip to content

Commit 31e37b4

Browse files
committed
chore: warn NaN vnode key
1 parent d86b01b commit 31e37b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/runtime-core/src/vnode.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ function _createVNode(
383383
appContext: null
384384
}
385385

386+
// validate key
387+
if (__DEV__ && vnode.key !== vnode.key) {
388+
warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type)
389+
}
390+
386391
normalizeChildren(vnode, children)
387392

388393
// presence of a patch flag indicates this node needs patching on updates.

0 commit comments

Comments
 (0)