Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-buttons-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/devtools-event-bus': patch
---

fix issue with broadcast channel not emitting functions properly and failing
4 changes: 2 additions & 2 deletions packages/event-bus/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ClientEventBus {
this.#connectToServerBus = connectToServerBus
this.#eventTarget = this.getGlobalTarget()
this.#broadcastChannel.onmessage = (e) => {
this.emitToClients(e.data, true)
this.emitToClients(JSON.parse(e.data), true)
}
this.debugLog('Initializing client event bus')
}
Expand All @@ -74,7 +74,7 @@ export class ClientEventBus {
// We only emit the events if they didn't come from the broadcast channel
// otherwise it would infinitely send events between
if (!fromBroadcastChannel) {
this.#broadcastChannel?.postMessage(event)
this.#broadcastChannel?.postMessage(JSON.stringify(event))
}
this.debugLog('Emitting event to global client listeners', event)
this.#eventTarget.dispatchEvent(globalEvent)
Expand Down
Loading