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

QueryValue is tied to Leptos Serializable #34

Open
Innominus opened this issue Jul 17, 2024 · 0 comments
Open

QueryValue is tied to Leptos Serializable #34

Innominus opened this issue Jul 17, 2024 · 0 comments

Comments

@Innominus
Copy link

Innominus commented Jul 17, 2024

I've run into a blocker trying to implement serde-lite or rkyv as my output for server functions in leptos. Note, this is purely CSR with no SSR. I have the CSR feature flag on, and no SSR flag.

Trying to implement serde-lite yields errors related to QueryValue not being implemented on my return types. It wants it to implement server_fn::serde::{Serialize, Deserialize} etc. This constraint can only be changed if you add the feature flag to Leptos for serde-lite. But this does not control the input or output from server functions. It only controls the initial streaming on first request in SSR mode. It seems the only way to change the underlying serializer of QueryValue is to set this feature flag, which doesn't allow for the other serializing types such as bson, toml, rkyv, etc etc.

Asides from that I'm having trouble just implementing serde-lite. So with the feature flag on, I get this as my error:
image
image
The Result<T,E> type does not have an implementation in serde-lite, and Leptos server functions don't expect it to. I've been told that Leptos server functions serialize the Result type that's returned from server functions as a http request, and the actual T value and E error are required to be serialized to the desired format. But I think Leptos Query relies on the entire return type being Serializable, but serde-lite does not have an implementation for the Result type.

If we ignore all of this, in Leptos Query's current state, how would I implement rkyv input and output on my types and use it with Leptos Query?

Thanks!
Also, amazing library. This has been my only hiccup so far because I don't want monomorphization so I can keep my binary as small as possible. Appreciate all the work that's gone into this.

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

No branches or pull requests

1 participant