fix(DeesComms): Skip routing hooks for BroadcastChannel-received messages to prevent infinite loops; update typedrequest dependency and bump package version.
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@design.estate/dees-comms',
|
||||
version: '1.0.28',
|
||||
version: '1.0.30',
|
||||
description: 'A communications module for enabling DOM-based messaging and synchronization across browser tabs and workers.'
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ export class DeesComms {
|
||||
this.broadcastChannel.onmessage = async (eventArg) => {
|
||||
const message = (eventArg as any).method ? eventArg : eventArg.data;
|
||||
console.log(JSON.stringify(message));
|
||||
const response = await this.typedrouter.routeAndAddResponse(message);
|
||||
// Skip hooks for broadcast-received messages to prevent infinite loops
|
||||
// when traffic logging hooks are set up globally
|
||||
const response = await this.typedrouter.routeAndAddResponse(message, { skipHooks: true });
|
||||
if (response && !response.error) {
|
||||
this.postMessage(response);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user