Hunter
Hunter
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Hunter on 7/27/2023 in #questions
Pattern for Prisma Generated Types are not Serializable
I really just do not want to: Have to define duplicate types that match what prisma generates. Where the only difference is that Date fields are converted to string fields. Are there any work arounds for this? Patterns? Ideas? Or maybe I just need to manage my own types and deal with converting between prisma and custom types. I can do this, I just really do not want to unless there's nothing else.
3 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 3/20/2023 in #questions
<suspense>
Thanks for this response, it makes sense to me. However run into another issue when using Suspense and either useSuspenseQuery or passing the {suspense: true option as you suggested. Error:
Text
Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.
Text
Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.
This is the code I've got:
function ReviewList() {
const query = api.strains.getStrain.useQuery(
{
id: 1,
},
{ suspense: true }
);
return (
<>
<h1>Review Page</h1>
<ul>
{query.data?.strain?.Reviews.map((review, index) => (
<li key={index}>{review.comment}</li>
))}
</ul>
</>
);
}
function ReviewList() {
const query = api.strains.getStrain.useQuery(
{
id: 1,
},
{ suspense: true }
);
return (
<>
<h1>Review Page</h1>
<ul>
{query.data?.strain?.Reviews.map((review, index) => (
<li key={index}>{review.comment}</li>
))}
</ul>
</>
);
}
I can't use startTransition since I do not have access to the set method of the trpc hook AFAIK. Which is listed as a limitation in reacts docs
6 replies
TTCTheo's Typesafe Cult
Created by pach on 5/4/2023 in #questions
"Unsafe assignment of `any` value
Relaoding vscode worked for me too 🤦‍♂️ I'll just throw that 15 minutes into the fire. Thanks for the post
7 replies