Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Maximum call stack size exceeded" in unwrapRefProxy #379

Closed
sapphi-red opened this issue Jun 12, 2020 · 4 comments · Fixed by #380
Closed

"Maximum call stack size exceeded" in unwrapRefProxy #379

sapphi-red opened this issue Jun 12, 2020 · 4 comments · Fixed by #380
Labels

Comments

@sapphi-red
Copy link
Contributor

RangeError: Maximum call stack size exceeded
    at unwrapRefProxy (vue-composition-api.module.js?750b:657)
    at _loop_1 (vue-composition-api.module.js?750b:648)
    at unwrapRefProxy (vue-composition-api.module.js?750b:654)
    at _loop_1 (vue-composition-api.module.js?750b:648)
    at unwrapRefProxy (vue-composition-api.module.js?750b:654)
    at _loop_1 (vue-composition-api.module.js?750b:648)
    at unwrapRefProxy (vue-composition-api.module.js?750b:654)
    at _loop_1 (vue-composition-api.module.js?750b:648)
    at unwrapRefProxy (vue-composition-api.module.js?750b:654)
    at _loop_1 (vue-composition-api.module.js?750b:648)

export function unwrapRefProxy(value: any) {
if (
isFunction(value) ||
isRef(value) ||
isArray(value) ||
isReactive(value) ||
!isPlainObject(value) ||
!Object.isExtensible(value)
) {
return value
}
const obj: any = {}
// copy symbols over
Object.getOwnPropertySymbols(value).forEach(
(s) => (obj[s] = (value as any)[s])
)
for (const k of Object.keys(value)) {
const r = value[k]
// if is a ref, create a proxy to retrieve the value,
if (isRef(r)) {
const set = (v: any) => (r.value = v)
const get = () => r.value
proxy(obj, k, { get, set })
} else {
obj[k] = unwrapRefProxy(r)
}
}
return obj
}

Changing this func like below will fix this error. (refs #361)

export function unwrapRefProxy(value: any) {
  return value
}
@antfu
Copy link
Member

antfu commented Jun 12, 2020

Looks like the object you passed to setup has cycle. You may also want to make sure if it's expected.

/cc @pikax should we keep a "traveled list"?

@sapphi-red
Copy link
Contributor Author

Oh, exactly it was so. (checked by passing object to JSON.stringify)

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Vue'
    |     property '$options' -> object with constructor 'Object'
    |     property 'router' -> object with constructor 'VueRouter'
    --- property 'app' closes the circle

@sapphi-red
Copy link
Contributor Author

sapphi-red commented Jun 12, 2020

This object may be SetupContext.

@pikax
Copy link
Member

pikax commented Jun 12, 2020

I will PR it in a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants