Skip to content

getPersistedSnapshot should have null fields instead of undefined? #4716

Answered by davidkpiano
rmgryan asked this question in General
Discussion options

You must be logged in to vote

A simpler workaround:

const persistedSnapshot = JSON.parse(JSON.stringify(actor.getPersistedSnapshot());

More info on the issue here: vercel/next.js#11209

It's unfortunate that NextJS doesn't play nicely with undefined but it's something to consider when using any 3rd-party library with NextJS, not just XState. The safest thing to do is to process the data regardless.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@rmgryan
Comment options

@rmgryan
Comment options

@davidkpiano
Comment options

Answer selected by rmgryan
@rmgryan
Comment options

@felipesabino
Comment options

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