From 4fd2ce813cd0a59bd544defe07f44a5731e45f84 Mon Sep 17 00:00:00 2001 From: Derek Kent Date: Thu, 28 Sep 2017 10:53:40 -0400 Subject: [PATCH] fix: allow an object's Symbols to be observed (#6704) Attempting to parseFloat on a Symbol throws the error `Cannot convert a Symbol value to a string`. A Symbol can be cast to a string using `.toString()` or `String()` though, so explicitly casting before parsing resolves the issue, allowing `Vue.set` to be called on Symbols. --- src/shared/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/util.js b/src/shared/util.js index 709fe14640..b6b3eb5dcb 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -56,7 +56,7 @@ export function isRegExp (v: any): boolean { * Check if val is a valid array index. */ export function isValidArrayIndex (val: any): boolean { - const n = parseFloat(val) + const n = parseFloat(String(val)) return n >= 0 && Math.floor(n) === n && isFinite(val) }