cross-tab-worker-databus 0.20.90 → 0.20.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -723,10 +723,12 @@ var WorkerClusterRuntime = class {
723
723
  const channel = this.channel;
724
724
  this.channel = null;
725
725
  this.handlers.onSuspend?.();
726
- if (typeof globalThis.setTimeout === "function") {
727
- globalThis.setTimeout(() => channel?.close(), 0);
728
- } else {
729
- channel?.close();
726
+ if (channel) {
727
+ if (typeof globalThis.setTimeout === "function") {
728
+ globalThis.setTimeout(() => channel.close(), 0);
729
+ } else {
730
+ channel.close();
731
+ }
730
732
  }
731
733
  }
732
734
  /** Update the worker's connection status and persist the change. */
@@ -2210,7 +2212,7 @@ var DedupManager = class {
2210
2212
  };
2211
2213
 
2212
2214
  // src/core/version.ts
2213
- var SDK_VERSION = true ? "0.20.90" : "";
2215
+ var SDK_VERSION = true ? "0.20.91" : "";
2214
2216
 
2215
2217
  // src/core/data-bus.ts
2216
2218
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
@@ -2392,6 +2394,7 @@ var CrossTabDataBus = class {
2392
2394
  // own broadcastEvent call, which always posts a DataBusMessage.
2393
2395
  onEvent: (eventType, payload, _sourceWorkerId, originTabId) => {
2394
2396
  if (eventType !== PUBLICATION_EVENT) return;
2397
+ if (typeof payload !== "object" || payload === null || typeof payload.topic !== "string") return;
2395
2398
  const incoming = payload;
2396
2399
  const message = incoming.originTabId !== void 0 ? incoming : originTabId !== void 0 ? { ...incoming, originTabId } : incoming;
2397
2400
  if (this.cluster.hasLocalSubscriber(message.topic)) this.dispatch(message);
@@ -3342,4 +3345,4 @@ export {
3342
3345
  parseDataBusPublication,
3343
3346
  selectWorkerBackend
3344
3347
  };
3345
- //# sourceMappingURL=chunk-L24ETFVK.js.map
3348
+ //# sourceMappingURL=chunk-DMM5KBNG.js.map