chore: trpc 11.x support (resolves #184)
Few things worth noting:
- This will break compatibility with tRPC 10.x.
- 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)
- Once tRPC 11.x has a stable release, the version specifier in
package.jsonwill need to be replaced (next->>=11.0.0) for both@trpc/clientand@trpc/serverindevDependencies. Otherwise tRPC 12.x unstable releases might be installed (whenever they start existing). - 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 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?
@mat-sz great! will this work with tRPC 11 Streaming? (uses a batchStreamLink)
Just bumping this issue to see if there are any updates! Also more than happy to test and/or help!
@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.
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.
Hello, why not merge yet? anything else to consider?
Any updates here?
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.