@sanity/vision 6.9.0-next.13 → 6.9.0-next.17

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.
@@ -1,5 +1,5 @@
1
1
  import { t as visionLocaleNamespace } from "./i18n-DWd7qwtK.js";
2
- import { Component, Fragment, forwardRef, useEffect, useEffectEvent, useImperativeHandle, useRef, useState } from "react";
2
+ import { Component, Fragment, Suspense, forwardRef, use, useEffect, useEffectEvent, useImperativeHandle, useRef, useState } from "react";
3
3
  import { ContextMenuButton, Translate, UserAvatar, getReleaseIdFromReleaseDocumentId, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useCurrentUser, useDataset, useDateTimeFormat, useKeyValueStore, usePerspective, useScheduledDraftsEnabled, useTranslation, useWorkspace } from "sanity";
4
4
  import { IntentLink } from "sanity/router";
5
5
  import { c } from "react/compiler-runtime";
@@ -41,7 +41,7 @@ import { JsonInspector } from "@rexxars/react-json-inspector";
41
41
  import { LinkIcon } from "@sanity/icons/Link";
42
42
  import LRU from "quick-lru";
43
43
  import { DocumentSheetIcon } from "@sanity/icons/DocumentSheet";
44
- import { useObservable } from "react-rx";
44
+ import { useObservablePromise } from "react-rx";
45
45
  import { catchError, map as map$1, of } from "rxjs";
46
46
  const API_VERSIONS = [
47
47
  "v1",
@@ -2641,7 +2641,7 @@ function useDatasets(t0) {
2641
2641
  } else t2 = $[4];
2642
2642
  t1 = t2;
2643
2643
  }
2644
- return useObservable(t1, null);
2644
+ return useObservablePromise(t1);
2645
2645
  }
2646
2646
  function _temp3(err) {
2647
2647
  return of(err);
@@ -2653,36 +2653,37 @@ function _temp(d) {
2653
2653
  return d.name;
2654
2654
  }
2655
2655
  function VisionContainer(props) {
2656
- let $ = c(19), t0;
2656
+ let $ = c(8), t0;
2657
2657
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "v2025-06-27" }, $[0] = t0) : t0 = $[0];
2658
2658
  let datasetsClient = useClient(t0), t1;
2659
2659
  $[1] !== datasetsClient || $[2] !== props.config.datasets ? (t1 = {
2660
2660
  client: datasetsClient,
2661
2661
  datasets: props.config.datasets
2662
2662
  }, $[1] = datasetsClient, $[2] = props.config.datasets, $[3] = t1) : t1 = $[3];
2663
- let loadedDatasets = useDatasets(t1);
2664
- if (!loadedDatasets) {
2665
- let t2;
2666
- return $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Flex, {
2667
- align: "center",
2668
- height: "fill",
2669
- justify: "center",
2670
- children: /* @__PURE__ */ jsx(DelayedSpinner, {})
2671
- }), $[4] = t2) : t2 = $[4], t2;
2672
- }
2673
- let t2;
2674
- $[5] !== loadedDatasets || $[6] !== props.client ? (t2 = loadedDatasets instanceof Error ? [props.client.config().dataset || "production"] : loadedDatasets, $[5] = loadedDatasets, $[6] = props.client, $[7] = t2) : t2 = $[7];
2675
- let datasets = t2, t3;
2676
- $[8] === props.client ? t3 = $[9] : (t3 = props.client.config(), $[8] = props.client, $[9] = t3);
2677
- let projectId = t3.projectId, t4;
2678
- $[10] !== datasets || $[11] !== props.client || $[12] !== props.config.defaultDataset ? (t4 = props.config.defaultDataset || props.client.config().dataset || datasets[0], $[10] = datasets, $[11] = props.client, $[12] = props.config.defaultDataset, $[13] = t4) : t4 = $[13];
2679
- let defaultDataset = t4, t5;
2680
- return $[14] !== datasets || $[15] !== defaultDataset || $[16] !== projectId || $[17] !== props ? (t5 = /* @__PURE__ */ jsx(VisionGui, {
2663
+ let datasetsPromise = useDatasets(t1), t2;
2664
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Flex, {
2665
+ align: "center",
2666
+ height: "fill",
2667
+ justify: "center",
2668
+ children: /* @__PURE__ */ jsx(DelayedSpinner, {})
2669
+ }), $[4] = t2) : t2 = $[4];
2670
+ let t3;
2671
+ return $[5] !== datasetsPromise || $[6] !== props ? (t3 = /* @__PURE__ */ jsx(Suspense, {
2672
+ fallback: t2,
2673
+ children: /* @__PURE__ */ jsx(LoadedVisionContainer, {
2674
+ ...props,
2675
+ datasetsPromise
2676
+ })
2677
+ }), $[5] = datasetsPromise, $[6] = props, $[7] = t3) : t3 = $[7], t3;
2678
+ }
2679
+ function LoadedVisionContainer(t0) {
2680
+ let $ = c(5), { datasetsPromise, ...props } = t0, loadedDatasets = use(datasetsPromise), datasets = loadedDatasets instanceof Error ? [props.client.config().dataset || "production"] : loadedDatasets, projectId = props.client.config().projectId, defaultDataset = props.config.defaultDataset || props.client.config().dataset || datasets[0], t1;
2681
+ return $[0] !== datasets || $[1] !== defaultDataset || $[2] !== projectId || $[3] !== props ? (t1 = /* @__PURE__ */ jsx(VisionGui, {
2681
2682
  ...props,
2682
2683
  datasets,
2683
2684
  projectId,
2684
2685
  defaultDataset
2685
- }, projectId), $[14] = datasets, $[15] = defaultDataset, $[16] = projectId, $[17] = props, $[18] = t5) : t5 = $[18], t5;
2686
+ }, projectId), $[0] = datasets, $[1] = defaultDataset, $[2] = projectId, $[3] = props, $[4] = t1) : t1 = $[4], t1;
2686
2687
  }
2687
2688
  /**
2688
2689
  * @internal
@@ -2766,4 +2767,4 @@ function SanityVision(props) {
2766
2767
  }
2767
2768
  export { SanityVision as default };
2768
2769
 
2769
- //# sourceMappingURL=SanityVision-MCdLivbU.js.map
2770
+ //# sourceMappingURL=SanityVision-BkNU10dg.js.map