You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom types cannot be used in load. This is not a limitation of devalue (which exposes a way to pass reducers/revivers, or functions that allow serde of custom types); it's just that this option is not exposed in SvelteKit.
My specific usecase is fetching data from an external API in load. This API returns, among other things, ISO date strings which I'd like to validate and enrich using luxon. If I could do this, then all throughout the rest of my app I can be sure that my dates are valid luxon.DateTime objects, which makes using and manipulating them a lot easier. Currently, my workflow is something like this:
Get data containing ISO date strings from API
Validate using luxon
Add timezones/change times using luxon
Serialise back to ISO date strings
Return from load
...
Parse using luxon again
Use
Having this feature would simplify the above to:
Get data containing ISO date strings from API
Validate using luxon
Add timezones/change times using luxon
Return from load
...
Use
Describe the proposed solution
Provide top-level APIs to register reducers and revivers for types, storing them in a global map
Pass this map to SvelteKit's internal uses of devalue so that they can be used for serde of custom types
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Describe the problem
Custom types cannot be used in
load
. This is not a limitation ofdevalue
(which exposes a way to pass reducers/revivers, or functions that allow serde of custom types); it's just that this option is not exposed in SvelteKit.My specific usecase is fetching data from an external API in
load
. This API returns, among other things, ISO date strings which I'd like to validate and enrich usingluxon
. If I could do this, then all throughout the rest of my app I can be sure that my dates are validluxon.DateTime
objects, which makes using and manipulating them a lot easier. Currently, my workflow is something like this:luxon
luxon
load
luxon
againHaving this feature would simplify the above to:
luxon
luxon
load
Describe the proposed solution
devalue
so that they can be used for serde of custom typesAlternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: