Skip to content

Circular object values crash <select> update #5055

@Tamschi

Description

@Tamschi

Vue.js version

2.2.1

Reproduction Link

https://jsfiddle.net/Tamschi/6q4Ljk0j/

Steps to reproduce

Create a vue-backed <select> element that satisfies the following conditions:

  • The selected value is an object.
  • At least one <option> has an object value.
  • At least one of these instances leads to a circular reference and does not appear only after a value that loosely equals the selected value in the option list.

What is Expected?

The Vue.js app should select the right option and avoid a crash.

What is actually happening?

The app crashes with

Uncaught TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at looseEqual ([email protected]:225)
    at setSelected ([email protected]:6674)
    at cb ([email protected]:6616)
    at inserted ([email protected]:6618)
    at callHook$1 ([email protected]:5102)
    at callInsert ([email protected]:5045)
    at wrappedHook ([email protected]:1690)
    at Object.invoker [as insert] ([email protected]:1637)
    at invokeInsertHook ([email protected]:4828)

looseEqual	@	[email protected]:225
setSelected	@	[email protected]:6674
cb	@	[email protected]:6616
inserted	@	[email protected]:6618
callHook$1	@	[email protected]:5102
callInsert	@	[email protected]:5045
wrappedHook	@	[email protected]:1690
invoker	@	[email protected]:1637
invokeInsertHook	@	[email protected]:4828
patch	@	[email protected]:4992
Vue._update	@	[email protected]:1994
updateComponent	@	[email protected]:2104
get	@	[email protected]:2417
Watcher	@	[email protected]:2400
mountComponent	@	[email protected]:2114
Vue$3.$mount	@	[email protected]:7153
Vue$3.$mount	@	[email protected]:9154
Vue._init	@	[email protected]:3652
Vue$3	@	[email protected]:3733
window.onload	@	(index):48

in Chrome and

TypeError: cyclic object value 1 vue:225:12
	looseEqual https://unpkg.com/vue:225:12
	setSelected https://unpkg.com/vue:6674:11
	inserted/cb https://unpkg.com/vue:6616:9
	inserted https://unpkg.com/vue:6618:7
	callHook$1 https://unpkg.com/vue:5102:5
	_update/callInsert https://unpkg.com/vue:5045:9
	wrappedHook https://unpkg.com/vue:1690:5
	invoker https://unpkg.com/vue:1637:9
	invokeInsertHook https://unpkg.com/vue:4828:9
	patch https://unpkg.com/vue:4992:5
	lifecycleMixin/Vue.prototype._update https://unpkg.com/vue:1994:16
	mountComponent/updateComponent https://unpkg.com/vue:2104:7
	get https://unpkg.com/vue:2417:13
	Watcher https://unpkg.com/vue:2400:7
	mountComponent https://unpkg.com/vue:2114:17
	Vue$3.prototype.$mount https://unpkg.com/vue:7153:10
	Vue$3.prototype.$mount https://unpkg.com/vue:9154:10
	initMixin/Vue.prototype._init https://unpkg.com/vue:3652:7
	Vue$3 https://unpkg.com/vue:3733:3
	window.onload https://fiddle.jshell.net/Tamschi/6q4Ljk0j/show/:48:1

in Firefox. (I thought I'd include both traces since they contain slightly different information.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions