]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: warn NaN vnode key
authorEvan You <yyx990803@gmail.com>
Mon, 6 Jul 2020 22:33:13 +0000 (18:33 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 6 Jul 2020 22:56:21 +0000 (18:56 -0400)
packages/runtime-core/src/vnode.ts

index f5ff1cdc362753e8e650383046ed32aceb83215c..943d43ab37edd9c55c50a8709fb6fd726803d7d2 100644 (file)
@@ -383,6 +383,11 @@ function _createVNode(
     appContext: null
   }
 
+  // validate key
+  if (__DEV__ && vnode.key !== vnode.key) {
+    warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type)
+  }
+
   normalizeChildren(vnode, children)
 
   // presence of a patch flag indicates this node needs patching on updates.