Closed epicmau5time closed 1 year ago
Hi @epicmau5time! Yes, that's how SuperJSON works. If you want to prevent this, you could delete
the unwanted properties.
Some Background: In JavaScript, there's a difference between a property not existing, and it having the value undefined
. We tend to call both things "being undefined", but they behave slightly different. e.g. Object.keys({}) === []
, whereas Object.keys({ foo: undefined }) === ["foo"]
. That's why SuperJSON makes a difference here.
When returning a list from the db with a ton of potential undefined fields, superjson just crams a ton of undefined's in meta:
Actual data: 1711 lines, Data + Meta: 3028 lines.
Is there a way to prevent superjson from adding "undefined" fields to meta?
Or is that just how superjson works?