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
I'm trying to use URQL to retrieve some posts from a DB and want it to be done in a server component. I'm using Next13.4+. Right now, I am using codegen to output my graphql.tsx based on my defined calls. Ex:
User-Defined:
query Posts {
posts {
id
createdAt
updatedAt
title
}
}
I want to import this into a RSC to use with the an urql client to essentially fetch data on the server before displaying any of it. Here is how I can get it to work temporarily.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to use URQL to retrieve some posts from a DB and want it to be done in a server component. I'm using Next13.4+. Right now, I am using codegen to output my graphql.tsx based on my defined calls. Ex:
User-Defined:
Code Generated:
I want to import this into a RSC to use with the an urql client to essentially fetch data on the server before displaying any of it. Here is how I can get it to work temporarily.
If I try to import the PostsDocument from the @/generated/graphql.tsx file, I get the error:
I'm aware this is because of the import at the top of the graphql.tsx document:
Is there a way that urql can function natively on the server when using the pre-generated code?
How can I successfully reuse the type safety of the generated code on the server side? Has anyone ran into this issue so far?
Beta Was this translation helpful? Give feedback.
All reactions