-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat(comlink)!: public api improvements #2207
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
571b818
to
a6ab174
Compare
a6ab174
to
00c02ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stellar work @rdunk! Absolutely love this 💖
As far as I'm concerned we should merge and publish this asap 🏎️ 💨
Looks like the new API signature has better typing and autocomplete as well :chefs-kiss:
A nice follow up could be to move the compatibility actor out of @repo/visual-editing-helpers
and to @sanity/comlink
, perhaps on its own export path, to resolve #2165 💖
a7d02f3
to
23a2933
Compare
That's a great idea! Thanks. |
This PR introduces some changes to the public API of
@sanity/comlink
that I've wanted to make for a while. There are no new features, this is mainly refactoring, but there are breaking changes. All consumers of the package in this repo have been updated accordingly, including the compatibility actors.This isn't strictly necessary from our point of view, but as this package is likely going to be used by other teams, I felt the improvements would be useful.
Terminology
In the initial version, I think some concepts were incorrectly named. The concepts of
Channels
andConnections
have now been swapped, which I think makes much more sense:(Apologies for the unorthodox use of diff block here 😄 )
post
andfetch
signaturesThe signatures for
.post()
and.fetch()
methods have changed:This is more concise and aligns with
.on()
, which already looks like this:Type argument order
The order of type arguments has been updated in many interfaces and functions. Placing
Sends
beforeReceives
feels more natural and aligns better with expectations: