electron-trpc icon indicating copy to clipboard operation
electron-trpc copied to clipboard

chore: trpc 11.x support (resolves #184)

Open mat-sz opened this issue 1 year ago • 12 comments

Few things worth noting:

  1. This will break compatibility with tRPC 10.x.
  2. tRPC 11.x is currently in RC state, so they will probably release a stable build soon. (see: https://www.npmjs.com/package/@trpc/server?activeTab=versions)
  3. Once tRPC 11.x has a stable release, the version specifier in package.json will need to be replaced (next -> >=11.0.0) for both @trpc/client and @trpc/server in devDependencies. Otherwise tRPC 12.x unstable releases might be installed (whenever they start existing).
  4. I've been using this for around 3 months in my own fork, with my app and I have noticed no issues; so the changes should be decently stable.

mat-sz avatar May 04 '24 11:05 mat-sz

@mat-sz I tried the basic-react example from your fork. One thing that I noticed is, that I loose all state in the components upon HMR. To demonstrate this I simply added a counter to the HelloElectron component like so:

  const [count, setCount] = useState(0);
  useEffect(() => {
    const interval = setInterval(() => {
      setCount((prev) => prev + 1);
    }, 1000);
    return () => clearInterval(interval);
  }, []);
  console.log('rendering counter', count);

Why is the counter reset upon every safe of the file? Is there a way to preserve it?

dastein1 avatar May 08 '24 08:05 dastein1

@mat-sz great! will this work with tRPC 11 Streaming? (uses a batchStreamLink)

enricoros avatar Jul 08 '24 23:07 enricoros

Just bumping this issue to see if there are any updates! Also more than happy to test and/or help!

spencekim avatar Sep 04 '24 04:09 spencekim

@enricoros batchStreamLink isn't supported since this isn't doesn't work via HTTP. We're using ipcLink here, which is different.

@spencekim Potentially, Blob support might be a problem, I will need to look into that.

mat-sz avatar Sep 13 '24 20:09 mat-sz

Thanks for the answer @mat-sz, I understand now. I'd need to change some logic to be able to return an async generator form the ipc link, I think.

enricoros avatar Sep 13 '24 22:09 enricoros

Hello, why not merge yet? anything else to consider?

liaodalin19903 avatar Dec 09 '24 07:12 liaodalin19903

Any updates here?

savss624 avatar Dec 22 '24 20:12 savss624

Folks, TRPC 11 is in beta and may have breaking API changes. I am not going to force consumers of electron-trpc onto the TRPC beta line.

There is an electron-trpc rewrite in progress which will be at least compatible with TRPC 11, and may be backwards compatible. It may be that the 0.x version of electron-trpc will be maintained for some time for TRPC users pre-11.

jsonnull avatar Dec 22 '24 20:12 jsonnull