Skip to content
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

Use superjson to stringify and parse data between server and client #662

Closed
wants to merge 3 commits into from
Closed

Use superjson to stringify and parse data between server and client #662

wants to merge 3 commits into from

Conversation

sergiodxa
Copy link
Member

@sergiodxa sergiodxa commented Nov 25, 2021

Fixes #656

This implements the Blitz.js superjson library to serialize and parse values.

This way if a loader or action returns undefined, BigInt, Date, RegExp, Set, Map or Error objects the useLoaderData will receive the instance of those objects instead of a string or on error because JSON.stringify can't serialize them.

@kentcdodds
Copy link
Member

This seems pretty sweet. Would be a breaking change so we'd probably want to start with a config option to enable this. Probably would want it to be unstable.

Even before that, a remix-superjson lib would be good for folks to try it out in real apps.

In any case, I can't say that we're going to merge this, but those are just a few of my thoughts.

@ryanflorence
Copy link
Member

Let's open a discussion for this. I think I like it?

@sergiodxa
Copy link
Member Author

Let's open a discussion for this. I think I like it?

There’s an issue here #656, maybe convert it to discussion?

@kentcdodds
Copy link
Member

Done: #1910

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

Successfully merging this pull request may close these issues.

3 participants