Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could this work with Next.js? #9

Open
cfortuner opened this issue Nov 22, 2022 · 8 comments
Open

Could this work with Next.js? #9

cfortuner opened this issue Nov 22, 2022 · 8 comments

Comments

@cfortuner
Copy link

Using the t3 stack and this could be a real help.

But i'm not sure if this could work with TRPC + Next.js

here we define the trpc client

import { createTRPCNext } from "@trpc/next";
export const trpc = createTRPCNext<AppRouter>({
 config() {
 ...
 })

Just wondering if you think these two could work together?

@dai-shi
Copy link
Member

dai-shi commented Nov 23, 2022

Thanks for asking.
jotai-trpc is a simple wrapper around trpc vanilla client. It's not even related with React.
I hope it technically works with next.js, but never tried. There might be something unexpected. Please give it a try and share what you find.

@bontaramsonta
Copy link

I am also confused as we are already using createTRPCNext which is needed for next.js then how to interop with createTRPCJotai

@dai-shi
Copy link
Member

dai-shi commented Jan 15, 2023

I think, usage-wise, createTRPCNext and createTRPCJotai are conflicting. Just like createTRPCReact and createTRPCNext conflict.

@alexgorbatchev
Copy link

It works if you don't fetch data on the server, otherwise I couldn't get it to work.

@drMonro
Copy link

drMonro commented Jun 2, 2023

Thanks for asking. jotai-trpc is a simple wrapper around trpc vanilla client. It's not even related with React. I hope it technically works with next.js, but never tried. There might be something unexpected. Please give it a try and share what you find.

It's work fine, use it in Next 13.4.4

@khari998
Copy link

Thanks for asking. jotai-trpc is a simple wrapper around trpc vanilla client. It's not even related with React. I hope it technically works with next.js, but never tried. There might be something unexpected. Please give it a try and share what you find.

It's work fine, use it in Next 13.4.4

Were you able to use it with async data?

@lewxdev
Copy link

lewxdev commented Dec 16, 2023

Any details or examples on how to get this working?

@ksonny
Copy link

ksonny commented Jun 19, 2024

I dug into this and tried to figure out how to make it work with next.js and app routing.
The solution I came to was to avoid doing any requests or async until everything is delivered to the client by using an atom.

Here's a gist with the client I'm using:
https://gist.github.com/ksonny/17583d98ee73fff0681613a1ada0a02b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants