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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mat-sz
Copy link

@mat-sz mat-sz commented May 4, 2024

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.

@dastein1
Copy link

dastein1 commented May 8, 2024

@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?

@enricoros
Copy link

enricoros commented Jul 8, 2024

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

@spencekim
Copy link

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

@mat-sz
Copy link
Author

mat-sz commented Sep 13, 2024

@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.

@enricoros
Copy link

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.

@liaodalin19903
Copy link

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

@savss624
Copy link

Any updates here?

@jsonnull
Copy link
Owner

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.

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

Successfully merging this pull request may close these issues.

7 participants