-
Hi folks, We're using This makes total sense to me because Ideally, I would like to keep the Other alternatives are:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I have asked before about exposing a way to customize turbo-stream and the team said they won't do it as it's a intermediate step before RSC streaming protocol is supported. Since turbo-stream doesn't automatically serialize values you would have to call |
Beta Was this translation helpful? Give feedback.
-
@nartc How did you end up solving this issue in your codebase? We're having the same problem (using Mongoose and RR7), and I have tried various combinations of Mongoose's I (think I) have settled on embracing function objectIdToString(objectId: { buffer: Record<string, number> }): string {
return Object.values(objectId.buffer)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('');
}
// Example
const mongooseObjectFromLoaderData = {
_id: {
buffer: {
"0": 100, "1": 246, "2": 57, "3": 181, "4": 215, "5": 58, "6": 154,
"7": 203, "8": 21, "9": 69, "10": 66, "11": 254
}
}
};
const hexString = objectIdToString(mongooseObjectFromLoaderData._id);
console.log(hexString); // "64f639b5d73a9acb154542fe" If you've come up with something better, I'd love to know! 🙏 |
Beta Was this translation helpful? Give feedback.
I have asked before about exposing a way to customize turbo-stream and the team said they won't do it as it's a intermediate step before RSC streaming protocol is supported.
Since turbo-stream doesn't automatically serialize values you would have to call
.toString()
yourself when sending a MongoDB document.