@sanity/client 7.11.0 → 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,26 +1481,31 @@ class LiveClient {
1481
1481
  "welcome",
1482
1482
  "reconnect",
1483
1483
  "goaway"
1484
- ]).pipe(
1485
- reconnectOnConnectionFailure(),
1486
- operators.map((event) => {
1487
- if (event.type === "message") {
1488
- const { data, ...rest } = event;
1489
- return { ...rest, tags: data.tags };
1490
- }
1491
- return event;
1492
- })
1493
- ), checkCors = fetchObservable(url, {
1484
+ ]), checkCors = fetchObservable(url, {
1494
1485
  method: "OPTIONS",
1495
1486
  mode: "cors",
1496
1487
  credentials: esOptions.withCredentials ? "include" : "omit",
1497
1488
  headers: esOptions.headers
1498
1489
  }).pipe(
1499
- rxjs.mergeMap(() => rxjs.EMPTY),
1500
1490
  rxjs.catchError(() => {
1501
1491
  throw new CorsOriginError({ projectId: projectId2 });
1502
1492
  })
1503
- ), observable = rxjs.concat(checkCors, events).pipe(
1493
+ ), observable = events.pipe(
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(
1497
+ rxjs.mergeMap(() => {
1498
+ throw err;
1499
+ })
1500
+ )),
1501
+ operators.map((event) => {
1502
+ if (event.type === "message") {
1503
+ const { data, ...rest } = event;
1504
+ return { ...rest, tags: data.tags };
1505
+ }
1506
+ return event;
1507
+ })
1508
+ ).pipe(
1504
1509
  operators.finalize(() => eventsCache.delete(key)),
1505
1510
  shareReplayLatest({
1506
1511
  predicate: (event) => event.type === "welcome"