Closed maxwen closed 3 months ago
When leptos sends resources, it first serializes them into JSON using serde, renders that into the HTML sent by the SSR, then it deserializes it again.
The problem is you're using deserialize_with
, but not serialize_with
. So during the first step, it serializes dt
as a String into JSON, then when it deserializes it from JSON again during hydration, it encounters this string when it's actually looking for a u64.
Thanks @luxalpa. This explanation sounds correct to me, and I don't see any need for action here — @maxwen let me know if this needs to be reopened.
Thx. will try to see if that solves the error
Add: Yes that solved it - thx again
Describe the bug Looks like using custom serde deserializers like
[serde(deserialize_with = "xxx")]
are not used since I get DeserializationError on those attributes when they are used in a create_resource call
Leptos Dependencies
To Reproduce
Using a async fn that returns something like
This object also used for graphQL queries therefore a long to string mapping is used.
So it seems its not using the serde deserializer? If I remove the custom serializer and change dt to u64 it works as expected and create_resource works
Expected behavior It should not create DeserializationError