Skip to content

Commit

Permalink
🎉 Publish JS rc.2
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Jul 19, 2023
1 parent 709f0c0 commit 2e237f7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@rspc/client",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "A blazingly fast and easy to use TRPC-like server for Rust.",
"keywords": [],
"author": "Oscar Beaumont",
Expand Down
8 changes: 7 additions & 1 deletion packages/client/src/links/wsLink.ts
Expand Up @@ -72,6 +72,7 @@ export function _internal_wsLinkInternal([activeMap, send]: ReturnType<
return {
exec: async (resolve, reject) => {
activeMap.set(id, {
oneshot: op.method !== "subscription",
resolve,
reject,
});
Expand Down Expand Up @@ -115,6 +116,8 @@ function newWsManager(opts: WsLinkOpts) {
const activeMap = new Map<
number,
{
// Should delete after first response
oneshot: boolean;
resolve: (result: any) => void;
reject: (error: Error | RSPCError) => void;
}
Expand All @@ -138,7 +141,10 @@ function newWsManager(opts: WsLinkOpts) {
resolve: item.resolve,
reject: item.reject,
});
if (result.type === "value" || result.type === "complete")
if (
(item.oneshot && result.type === "value") ||
result.type === "complete"
)
activeMap.delete(result.id);
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
@@ -1,6 +1,6 @@
{
"name": "@rspc/react",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "A blazingly fast and easy to use TRPC-like server for Rust.",
"keywords": [],
"author": "Oscar Beaumont",
Expand Down
2 changes: 1 addition & 1 deletion packages/tauri/package.json
@@ -1,6 +1,6 @@
{
"name": "@rspc/tauri",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "A blazingly fast and easy to use TRPC-like server for Rust.",
"keywords": [],
"author": "Oscar Beaumont",
Expand Down
6 changes: 5 additions & 1 deletion packages/tauri/src/index.ts
Expand Up @@ -20,6 +20,7 @@ function newWsManager() {
const activeMap = new Map<
number,
{
oneshot: boolean;
resolve: (result: any) => void;
reject: (error: Error | RSPCError) => void;
}
Expand All @@ -42,7 +43,10 @@ function newWsManager() {
resolve: item.resolve,
reject: item.reject,
});
if (result.type === "value" || result.type === "complete")
if (
(item.oneshot && result.type === "value") ||
result.type === "complete"
)
activeMap.delete(result.id);
}
});
Expand Down

0 comments on commit 2e237f7

Please sign in to comment.