nehalist
Implementing a "Prisma model converter middleware"
Bit of a fancy name, but if you've ever worked with Symfonys param converters (especially the DoctrineParamConverter) you get the idea. It's basically just automatically converting input to models.
Currently trying to implement this, but can't find a way for proper types. Implementation so far:
Unfortunately I can't come up with a solution to knowing the types here. Anyone got some ideas 🙂 ?
2 replies
Is there a way to transform data server-side only?
I'd like to implement something like Symfonys ParamConverter that converts certain params, but server-side only, so that I can use Prisma and alike. Couldn't figure out how to use data transformers for this use case
3 replies
Has anyone ever used tRPC (with SSR) and i18n?
No matter the lib (next-intl, next-i18n, next-translate), I simply stumble from one problem to another - most of them simply solved by disabling SSR. Unfortunately, I need SSR and i18n. I know the GitHub issue that the problem here is on next.js, but anyone ever solved this? Hard to believe no one has ever used tRPC with i18n
35 replies
Request context from getServerSideProps
The docs of tRPC context https://trpc.io/docs/v10/context
But how to use this function from
getServerSideProps
(in order to use SSG helpers)?2 replies
tRPC without SSR
When using tRPC with ssr it uses
getInitialProps
, which has kinda of a cool effect in terms how a page is rendered, since it's rendered server-side on initial requests and client-side on route transitions.
Unfortunately, enabling ssr means that you can no longer use getServerSideProps
(which I know is only fixable by next.js and not tRPC). But how to replicate the getInitialProps
behaviour then?
Let's say I'm building a blog; due to SEO it's basically necessary to render my posts server-side. But when navigating through the site loading posts on the fly would be totally fine. How to do that without ssr
?16 replies
Load data client-side via react-query while using tRPC with SSR
Is there any way to load data client-side when using tRPC? I want my page to be rendered and load data dynamically, since this data is not SEO-relevant. As far as I'm understanding as soon as I turn on SSR in tRPC queries must be done before the page is rendered.
11 replies
SSR and loading indicators - I don't get it
Guess I'm missing something here, but unfortunately I'm having a hard time with the docs: in https://trpc.io/docs/v10/nextjs the example
utils/trcp.ts
sets ssr: true
, but the pages/index.tsx
example uses
Since SSR would prevent the page from being rendered until the queries are done, how would this loading indicator ever been shown?1 replies