Closed dgrcode closed 1 year ago
Hey @dgrcode, thanks for reporting this! Seems like something we should look into. Reading through the lengths of this, I think it'd be very helpful to have a failing reproduction test for this. Could you maybe reproduce this as a failing test in https://github.com/blitz-js/superjson/blob/main/src/index.test.ts, and open a PR with it? That'd allow for easier fixing, I think.
Sure! I'll get to it as soon as possible. That's hopefully later today or tomorrow 🤞
Thanks for replying so fast :)
I've been trying to debug this, but after some time spent looking at breakpoints I can't manage to understand why the object to be serialised is coming as
undefined
.The complete stack trace:
I'm using NextJS and react query. The problem seems to come when superjson tries to serialize react query's dehydrated state.
Debugging this issue I've found what object is exactly causing the problem, but I can't manage to find a solution debugging the dist files. I'll show what works, and what breaks.
Working code
These are the JSON representation of relevant objects there:
template
:props.dehydratedState
:Breaking code
These are the JSON representation of the relevant objects here:
templates
(same as before)t
:props.dehydratedState
:Differences
To simplify finding out what's going on, this is the diff between the two
dehydratedState
sThe timestamp difference of
dataUpdatedAt
is just the cache "updated at" timestamp, not the actual "updated at" from the database object.