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

Error on complex view #2

Closed
gapipro opened this issue Nov 19, 2014 · 4 comments
Closed

Error on complex view #2

gapipro opened this issue Nov 19, 2014 · 4 comments

Comments

@gapipro
Copy link

gapipro commented Nov 19, 2014

Hi,

so on most of complex views I get displayed following error when inspecting inner elements (mostly elements in inner component):

 message: "Converting circular structure to JSON"
@gapipro
Copy link
Author

gapipro commented Nov 20, 2014

So I looked into code and problem was with "clone" method.

This is my temporary solution:

function setPanelContent() {
    if ($0) {
        var el = $0
        var instance = el.__vue__
        while ((!instance || instance._isAnonymous) && el.parentNode) {
            el = el.parentNode
            instance = el.__vue__
        }
        if (!instance) {
            return {}
        } else {
            window.$vue = instance
            var state = {}
            var meta = ['$value', '$index', '$key']
            for (var key in instance) {
                if (key.charAt(0) === '_') continue
                if (key.charAt(0) === '$' && meta.indexOf(key) < 0) continue
                if (typeof instance[key] === 'function') continue
                if (instance.hasOwnProperty(key)) {
                    state[key] = instance[key]
                } else {
                    (state.$$scope = (state.$$scope || {}))[key] = instance[key]
                }
            }
            return {
                $$owner: instance,
                view: state
            }
        }
    } else {
        return {}
    }
}

@yyx990803
Copy link
Member

Which clone method are you referring to?
Are you pointing any reference to other vms in your code?

@gapipro
Copy link
Author

gapipro commented Nov 25, 2014

I referred to this line of code:

state = JSON.parse(JSON.stringify(state))

And I am not pointing to any other vms.
By inspecting inner vm (component) maybe there is a circular dependency because it has reference to root/parent by default?

@yyx990803
Copy link
Member

Now fixed in 0.0.2! Updates should roll out automatically soonish.

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

No branches or pull requests

2 participants