-
Notifications
You must be signed in to change notification settings - Fork 96
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
Transfer ownership to Blitz.js #5
Comments
Thanks @matthewmueller! For context, here's the discussion in the Blitz repo: blitz-js/legacy-framework#695 The extra metadata is required to revive For example, in a Blitz app the types in the frontend are often derived from the types in the database. So if a timestamp is stored as string, the type must be a string when deserialized in the frontend. And likewise if the timestamp is stored as a date in the database. With this new API, we will send both the serialized json and the metadata to the frontend where it can be correctly deserialized. Regarding the APII just realized there's a slight difference here between what superjson currently does and what we need. Currently superjson converts objects to a string and back. But we don't need that, what we need is serializing Javascript to a plain object and then converting plain objects back to Javascript. So actually we need to add this: // json, meta are plain objects without Date/Map/Set
const {json, meta} = superjson.serialize(input)
// output is Javascript with Date/Map/Set
const output = superjson.deserialize(json, meta) |
Not knowing if the result of I think picking alternative methods is the right way forward. I like I've added you to the NPM package and Github. If you'd like to transfer this repository to the |
@matthewmueller awesome, thanks! And yes, it'd be great to transfer it to the |
Looks like I don't have permission to do this. I've given you admin rights so you can move it yourself. |
@flybayer is interested in taking over this project for use in Blitz.js. He aims to maintain backwards compatibility with the existing API, but bring new features like Maps & Sets.
The thinking currently is to add the following API:
@flybayer, do you mind sharing a bit more about how metadata is used? Currently with superjson all the metadata is encoded into the data itself. Have you run into a situation where that doesn't work?
The text was updated successfully, but these errors were encountered: