Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

How to align the client/server DX? #20

Open
KATT opened this issue Oct 28, 2022 · 4 comments
Open

How to align the client/server DX? #20

KATT opened this issue Oct 28, 2022 · 4 comments

Comments

@KATT
Copy link
Member

KATT commented Oct 28, 2022

Currently, we use rsc.* to fetch data on the server and trpc.* on the client.

I wish this was the same object used so you didn't have to care if you're on the server or the client.

@iduuck
Copy link

iduuck commented Oct 28, 2022

fwiw, this is the best dx in my eyes. with this, we have the clear separation of where the data actually comes from. so there is no issue in whether we are fetching client-side or server-side.

imo...

@sachinraja
Copy link
Member

sachinraja commented Oct 30, 2022

This isn't possible because with the react-server export condition because you have to pass appRouter for rsc. We can't/don't want to import that on the client. So I think we'd have to go for transpiling if we wanted to do this.

@mmkal
Copy link
Collaborator

mmkal commented Oct 30, 2022

Would something like this help if there was some logic that didn't resolve the router unless it was needed?

createTrpcThingy({
  router: () => import('~/path/to/router'),
  ...otherOptions,
})

or would it affect client bundles?

@sachinraja
Copy link
Member

ohh yes I think that would help @mmkal! Great idea, I'll try it.

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

No branches or pull requests

4 participants