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

Server functions inconsistent withrkyv feature on leptos crate #1989

Closed
thestarmaker opened this issue Nov 5, 2023 · 4 comments
Closed

Server functions inconsistent withrkyv feature on leptos crate #1989

thestarmaker opened this issue Nov 5, 2023 · 4 comments

Comments

@thestarmaker
Copy link
Contributor

Describe the bug
Hello, this is borderline bug/feature request; raising as bug as behaviour is unexpected for the end user.

Currently leptos crate supports rkyv feature for serealisation/deserelisation, this enables Suspense to work with rkyv serialisation (or at least that used to be the case). The leptos_macro crate on the other hand does not support rkyv serialisation on server-side functions (only serde).

Since leptos_macro is not explicitly added to project dependencies, it is natural for user to assume that the feature changing the serialisation method on leptos crate would get propagated to all transient logic. This is not the case as server-side functions only support serde.

Leptos Dependencies

leptos = { version = "0.5.1", features = ["nightly", "rkyv"] }
leptos_meta = { version = "0.5.1", features = ["nightly"] }
leptos_router = { version = "0.5.1", features = ["nightly"] }
leptos_axum = { version = "0.5.1" }

rkyv = "0.7.42"

To Reproduce
Setup a new project, set rkyv feature on leptos, attemopt creating a server-side function that would use rkyv serialised struct.

Expected behavior
It should compile and when invoked should use rkyv serialisation.

@gbj
Copy link
Collaborator

gbj commented Nov 5, 2023

In spirit this is a duplicate of #1501, asking about serde-lite support for server functions, and so I'll link to my answer there, which holds true but replacing one crate for the other.

This is not something I'll have the capacity to work on but I'd be happy to look at a PR adding it.

@gbj
Copy link
Collaborator

gbj commented Nov 5, 2023

Oh, for what it's worth these features have always, only referred to how resources are serialized during server rendering. I would think that a server function called during server rendering with rkyv enabled would be serialized during server rendering with rkyv, even though that isn't supported in server functions (see docs for #[server].

If this isn't the case I'm happy to look at a reproduction. (I mean a code sample I can copy and paste, ie more detailed than what you wrote above.)

@benwis
Copy link
Contributor

benwis commented Dec 8, 2023

I'm not sure we'll be unifying these feature flags, but rkyv for server functions is coming in the next release

@gbj gbj mentioned this issue Jan 4, 2024
20 tasks
@gbj
Copy link
Collaborator

gbj commented Jan 20, 2024

rkyv server functions added in #2158.

@gbj gbj closed this as completed Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants