WARN: Cannot stringify arbitrary non-POJOs
See original GitHub issueHi,
I installed and run vuex-orm/vuex-orm-examples-nuxt and I got warnings on terminal for every page refresh:
WARN Cannot stringify arbitrary non-POJOs Todo
WARN Cannot stringify arbitrary non-POJOs User
I get same warnings in my project, which uses latest Nuxt (v.2.3.2).
Kind Regards,
Issue Analytics
- State:
- Created 5 years ago
- Comments:28 (14 by maintainers)
Top Results From Across the Web
`Cannot stringify arbitrary non-POJOs` and `Invalid prop
About the non POJO's warning: I solved the problem converting the class object to a POJO's at toJSON() function (which is the function ......
Read more >Error when trying to do pagination with Nuxt and Firebase
tomifis February 10, 2022, 10:29pm #3. I get this warning: WARN Cannot stringify arbitrary non-POJOs QueryDocumentSnapshot.
Read more >Connect your content to SvelteKit - Sanity.io
objectProtoOwnPropertyNames) {\n throw new Error(\"Cannot stringify arbitrary non-POJOs\");\n }\n if (Object.getOwnPropertySymbols(thing).length \u003E 0) ...
Read more >Maximum call stack size exceeded - Netlify Support Forums
WARN Cannot stringify a function validateStatus 13:55:28. WARN Cannot stringify arbitrary non-POJOs ClientRequest 13:55:28
Read more >Nuxt Store (Vuex) with multiple api calls using nuxtServerInit?
WARN Cannot stringify arbitrary non-POJOs ClientRequest 19:01:12. WARN Cannot stringify a function httpAdapter 19:01:13.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe this can help someone:
I solved the problem converting the class object to a POJO’s at
toJSON()function (which is the functiondevaluelibrary calls). So an example would be:It’s a clear solution which also makes sense to solve the warning.
Yeah. I think it’s going to solve this unless we make internal change to the Vuex ORM.
Basically, Nuxt is hydrating the store state, and sending it to the client as a string. Then, at the client side, it uses that hydrated store. So, the state gets serialized before the store state is getting send to the client. Therefor, it throws that warning that it is failing to serialize the store state, because it stores class instances (models).
I think, generally speaking, Vue, Vuex and Nuxt don’t want to developer to store anything but serializable object to the store state – which is I think no Functions.
To avoid this, Vuex ORM must store pure object to the store (not class instance), and then re instantiate each records when we fetch through getters. This was what it was few month ago with Vuex ORM. I’ve changed it to get a bit more performance boost, and also to implement index mapping.
Maybe we should go back to old days…? Or maybe we could wait until Vuex 3 comes out (and hopefully Vuex 4), to see what is the right way to go. I guess we need more discussion on this topic.