@sanity/client 7.11.0-live-cors → 7.11.1

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.
@@ -1481,7 +1481,7 @@ class LiveClient {
1481
1481
  "welcome",
1482
1482
  "reconnect",
1483
1483
  "goaway"
1484
- ]), checkCors$ = fetchObservable(url, {
1484
+ ]), checkCors = fetchObservable(url, {
1485
1485
  method: "OPTIONS",
1486
1486
  mode: "cors",
1487
1487
  credentials: esOptions.withCredentials ? "include" : "omit",
@@ -1489,19 +1489,17 @@ class LiveClient {
1489
1489
  }).pipe(
1490
1490
  rxjs.catchError(() => {
1491
1491
  throw new CorsOriginError({ projectId: projectId2 });
1492
- }),
1493
- operators.shareReplay(1)
1494
- // run only once
1492
+ })
1495
1493
  ), observable = events.pipe(
1496
- rxjs.catchError((err) => (console.log("[live] err from catchError", err), checkCors$.pipe(
1497
- rxjs.mergeMap(() => (console.log("[live] err from checkCors$", err), rxjs.of(err))),
1494
+ reconnectOnConnectionFailure(),
1495
+ rxjs.mergeMap((event) => event.type === "reconnect" ? checkCors.pipe(rxjs.mergeMap(() => rxjs.of(event))) : rxjs.of(event)),
1496
+ rxjs.catchError((err) => checkCors.pipe(
1498
1497
  rxjs.mergeMap(() => {
1499
- throw console.log("[live] throwing err from checkCors$", err), err;
1498
+ throw err;
1500
1499
  })
1501
- ))),
1502
- reconnectOnConnectionFailure(),
1500
+ )),
1503
1501
  operators.map((event) => {
1504
- if (console.log("event", event), event.type === "message") {
1502
+ if (event.type === "message") {
1505
1503
  const { data, ...rest } = event;
1506
1504
  return { ...rest, tags: data.tags };
1507
1505
  }