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

Converting circular structure to JSON #541

Closed
msudgh opened this issue Apr 10, 2017 · 6 comments
Closed

Converting circular structure to JSON #541

msudgh opened this issue Apr 10, 2017 · 6 comments
Labels

Comments

@msudgh
Copy link

msudgh commented Apr 10, 2017

When I navigate to an address directly by entering in address bar I got below error.

TypeError: Converting circular structure to JSON
    at Object.stringify (native)
    at serialize (/home/masoud/Sources/cynthia-mobile/node_modules/serialize-javascript/index.js:72:20)
    at _callee2$ (/home/masoud/Sources/cynthia-mobile/node_modules/nuxt/dist/nuxt.js:1343:132)
    at tryCatch (/home/masoud/Sources/cynthia-mobile/node_modules/regenerator-runtime/runtime.js:64:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/home/masoud/Sources/cynthia-mobile/node_modules/regenerator-runtime/runtime.js:299:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/masoud/Sources/cynthia-mobile/node_modules/regenerator-runtime/runtime.js:116:21)
    at onFulfilled (/home/masoud/Sources/cynthia-mobile/node_modules/co/index.js:65:19)
This question is available on Nuxt.js community (#c466)
@alexchopin
Copy link
Member

Hi, can you be more specific about your issue with some code snippets for example?

@msudgh
Copy link
Author

msudgh commented Apr 12, 2017

In Album page I have a component with the name of player that pass albumInfo as props to player component and By debugging, I'm sure that problem is related to this object, but I don't why exactly?

The problem occur when I navigate to localhost:3000/album/uid address directly by entering in address bar.

screenshot_20170412_104444

@msudgh
Copy link
Author

msudgh commented Apr 12, 2017

Oh, I figure out that I can't use route object in the albumInfo.
Isn't possible to use route object like above example?

@pi0
Copy link
Member

pi0 commented Apr 12, 2017

@msudgh Generally you can't store any function in data. This example throws foo() is not a function exception!

       asyncData() {
            return {
                foo() {
                    console.log("Bar")
                }
            }
        },
        mounted() {
          console.log(this.foo())
        },

BTW route is injected to component instance and you can access route using this.$route and router using this.$router anywhere.

@msudgh
Copy link
Author

msudgh commented Apr 12, 2017

Yeah, I got it. it was just a bad mistake.
By the way, Thanks.

@lock
Copy link

lock bot commented Nov 2, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 2, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants