Skip to content

Commit

Permalink
fix: enable adapters in subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
diegodelrieu committed Apr 22, 2024
1 parent 8386348 commit 414257b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/adapter/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ export const createChromeHandler = <TRouter extends AnyRouter>(
}

const subscription = result.subscribe({
next: (data) => sendResponse({ result: { type: 'data', data } }),
next: (data) => {
const serializedData = transformer.output.serialize(data);
sendResponse({ result: { type: 'data', data: serializedData } });
},
error: handleError,
complete: () => sendResponse({ result: { type: 'stopped' } }),
});
Expand Down
6 changes: 5 additions & 1 deletion src/adapter/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ export const createWindowHandler = <TRouter extends AnyRouter>(
}

const subscription = result.subscribe({
next: (data) => sendResponse({ result: { type: 'data', data } }),
next: (data) => {
const serializedData = transformer.output.serialize(data);

sendResponse({ result: { type: 'data', data: serializedData } });
},
error: handleError,
complete: () => sendResponse({ result: { type: 'stopped' } }),
});
Expand Down

0 comments on commit 414257b

Please sign in to comment.