[✨] Custom Class serialization #163
Replies: 6 comments
-
|
https://github.com/bluesky-social/atproto has a class object BlobRef that is also not serializable, would love to write a custom serializer instead of bugging the authors to change it. |
Beta Was this translation helpful? Give feedback.
-
|
Facing a similar challenge with Prisma returning a Decimal object. Would it be possible to support adding custom serializers via a vite plugin? |
Beta Was this translation helpful? Give feedback.
-
|
Custom serializers is a complex problem, which is why we have been punting it. Perhaps you can send a PR to add the Decimal Object? |
Beta Was this translation helpful? Give feedback.
-
|
I think most custom serializers can be avoided by putting methods in the store that on invocation check if the desired object exists and if not, create it with noSerialize before doing their own work. The technique I describe here can be useful for that. I don't think Qwik should ship with support for random libraries but maybe the $sync proposal can help with doing actual custom serialization |
Beta Was this translation helpful? Give feedback.
-
|
We moved this issue to |
Beta Was this translation helpful? Give feedback.
-
|
closing this as we have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
I'm using MongoDB and every request contains one or more
ObjectIdclass object which can not be serialized.And I'm lazy to write a bunch of
.maps and.toString()s to convert those fields to string manually.Describe the solution you'd like
Write a bunch of
.maps and.toString()s after every request is too terrible for me.I'm looking for those solutions
ObjectIdinmongodb(or inbson) just likeURLandDate. (ideal but a waste for non-mongodb user)toString()orqSerialize()function automatically. (however, usingtoString()converts any class object intostring, which requires additional type transform inuseLoader()anduseAction, etc.)Describe alternatives you've considered
n/a
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions