Skip to content

Commit

Permalink
Revert changing addSubscription to an async function
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavenVolkoff committed Oct 9, 2024
1 parent 9acb6ea commit b232178
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/client/src/v2/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ export class AlphaClient<P extends ProceduresDef> {
}
}

async addSubscription<
addSubscription<
K extends P['subscriptions']['key'] & string,
TData = inferProcedureResult<P, 'subscriptions', K>,
>(
keyAndInput: [K, ..._inferProcedureHandlerInput<P, 'subscriptions', K>],
opts: SubscriptionOptions<TData> & { context?: OperationContext }
): Promise<() => void> {
): () => void {
try {
const keyAndInput2 = this.mapQueryKey?.(keyAndInput) ?? keyAndInput

Expand All @@ -131,7 +131,10 @@ export class AlphaClient<P extends ProceduresDef> {
return result.abort
} catch (err) {
if (err instanceof RSPCError) {
if (this.onError) await this.onError(err)
if (this.onError)
this.onError(err)?.catch(error => {
console.error('Failure during onError handler for addSubscription', error)
})
return () => {}
}

Expand Down

0 comments on commit b232178

Please sign in to comment.