Skip to content

Commit 70ecce4

Browse files
committed
provide warning on frozen objects in v-for (ref #2809)
1 parent 2486a3b commit 70ecce4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/directives/public/for.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,13 @@ const vFor = {
426426
process.env.NODE_ENV !== 'production' &&
427427
this.warnDuplicate(value)
428428
}
429-
} else {
429+
} else if (Object.isExtensible(value)) {
430430
def(value, id, frag)
431+
} else if (process.env.NODE_ENV !== 'production') {
432+
warn(
433+
'Frozen v-for objects cannot be automatically tracked, make sure to ' +
434+
'provide a track-by key.'
435+
)
431436
}
432437
}
433438
frag.raw = value

0 commit comments

Comments
 (0)