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

[Feature?]: When seroval fails to serialize an object, treat it as json #1745

Open
2 tasks done
huseeiin opened this issue Jan 31, 2025 · 2 comments
Open
2 tasks done
Labels
enhancement New feature or request

Comments

@huseeiin
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

const getProcess = query(async () => {
  "use server";

  return process;
}, "process");

const process = createAsync(() => getProcess());

return (
  <Suspense fallback={<p>Loading...</p>}>{JSON.stringify(process())}</Suspense>
);

seroval doesn't know how to serialize process. how about treat something that can't be serialized as normal json?

Examples 🌈

if the solution is implemented, this is how it'd work under the hood:

const getProcess = query(async () => {
  "use server";

  return JSON.parse(JSON.stringify(process));
}, "process");

const process = createAsync(() => getProcess());

return (
  <Suspense fallback={<p>Loading...</p>}>{JSON.stringify(process())}</Suspense>
);

Motivation 🔦

this allows for more room for other types of values

@huseeiin huseeiin added the enhancement New feature or request label Jan 31, 2025
@lxsmnsyc
Copy link
Member

lxsmnsyc commented Jan 31, 2025

This is too dangerous. Majority of process info is sensitive. Are you really sure you want to serialize this?

Regardless, this won't be supported like any other "unserializable" objects.

@huseeiin
Copy link
Contributor Author

huseeiin commented Jan 31, 2025

This is too dangerous. Majority of process info is sensitive. Are you really sure you want to serialize this?

Regardless, this won't be supported like any other "unserializable" objects.

oh, regarding that, no, i of course don't wanna serialize process. this is just an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants