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
renderJsonPayloads causes Cannot stringify arbitrary non-POJOs error #20787
Comments
Thank you so much for the update! I would be very interested to know what's in your payload... any chance of getting a reproduction or access to your repo? |
Thanks for the quick reply @danielroe . Okay I think i found the issue: In my project I am using this pinia store import { acceptHMRUpdate, defineStore } from 'pinia'
export const useActiveDocumentStore = defineStore('activeDocument', () => {
/**
* Current named of the user.
*/
const activeDocument = ref<Pdf>()
const setBerechtigung = (berechtigung: Berechtigung) => {
activeDocument.value!.berechtigung_id = berechtigung.id
activeDocument.value!.berechtigung = berechtigung
}
return {
activeDocument,
setBerechtigung,
}
})
if (import.meta.hot)
import.meta.hot.accept(acceptHMRUpdate(useActiveDocumentStore, import.meta.hot)) With renderJSONPayloads disabled this leads to the following part within the payload: pinia: { activeDocument: { activeDocument: void 0 }, menu: { sideBarOpen: c } }, This seems to cause the error when renderJSONPayloads is enabled. Because when I am initializing the ref with null instead of implicit undefined: const activeDocument = ref<Pdf |null>(null) The error is gone with renderJSONPayloads enabled. Hopefully this helps |
@danielroe I have here similiar error: When you declare something like this import { defineStore } from 'pinia';
class Foo {
foo: string = 'foo';
}
export const useFooStore = defineStore('FOO_STORE', () => {
const foo = ref<Foo>(new Foo());
return {
foo,
};
}); I'm getting the same error |
Thanks @kstraszewski for your answer, its helped |
Environment
Reproduction
Will try later if needed
Describe the bug
After updating my nuxt project I experienced the following error message on ssr ( hitting the same routes on client side navigation is fine):
Its working fine again when disabling renderJsonPayloads
Additional context
Seems to be related to #20770 and #19205
Logs
No response
The text was updated successfully, but these errors were encountered: