@sanity/vision 6.9.0-next.9 → 6.9.0

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, 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";
@@ -9,6 +9,7 @@ import { SplitPane } from "@rexxars/react-split-pane";
9
9
  import { ChevronLeftIcon } from "@sanity/icons/ChevronLeft";
10
10
  import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
11
11
  import { isHotkey } from "is-hotkey-esm";
12
+ import { useEffectEvent } from "use-effect-event";
12
13
  import { closeBrackets } from "@codemirror/autocomplete";
13
14
  import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
14
15
  import { javascriptLanguage } from "@codemirror/lang-javascript";
@@ -41,7 +42,7 @@ import { JsonInspector } from "@rexxars/react-json-inspector";
41
42
  import { LinkIcon } from "@sanity/icons/Link";
42
43
  import LRU from "quick-lru";
43
44
  import { DocumentSheetIcon } from "@sanity/icons/DocumentSheet";
44
- import { useObservable } from "react-rx";
45
+ import { useObservablePromise } from "react-rx";
45
46
  import { catchError, map as map$1, of } from "rxjs";
46
47
  const API_VERSIONS = [
47
48
  "v1",
@@ -2641,7 +2642,7 @@ function useDatasets(t0) {
2641
2642
  } else t2 = $[4];
2642
2643
  t1 = t2;
2643
2644
  }
2644
- return useObservable(t1, null);
2645
+ return useObservablePromise(t1);
2645
2646
  }
2646
2647
  function _temp3(err) {
2647
2648
  return of(err);
@@ -2653,36 +2654,37 @@ function _temp(d) {
2653
2654
  return d.name;
2654
2655
  }
2655
2656
  function VisionContainer(props) {
2656
- let $ = c(19), t0;
2657
+ let $ = c(8), t0;
2657
2658
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "v2025-06-27" }, $[0] = t0) : t0 = $[0];
2658
2659
  let datasetsClient = useClient(t0), t1;
2659
2660
  $[1] !== datasetsClient || $[2] !== props.config.datasets ? (t1 = {
2660
2661
  client: datasetsClient,
2661
2662
  datasets: props.config.datasets
2662
2663
  }, $[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, {
2664
+ let datasetsPromise = useDatasets(t1), t2;
2665
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Flex, {
2666
+ align: "center",
2667
+ height: "fill",
2668
+ justify: "center",
2669
+ children: /* @__PURE__ */ jsx(DelayedSpinner, {})
2670
+ }), $[4] = t2) : t2 = $[4];
2671
+ let t3;
2672
+ return $[5] !== datasetsPromise || $[6] !== props ? (t3 = /* @__PURE__ */ jsx(Suspense, {
2673
+ fallback: t2,
2674
+ children: /* @__PURE__ */ jsx(LoadedVisionContainer, {
2675
+ ...props,
2676
+ datasetsPromise
2677
+ })
2678
+ }), $[5] = datasetsPromise, $[6] = props, $[7] = t3) : t3 = $[7], t3;
2679
+ }
2680
+ function LoadedVisionContainer(t0) {
2681
+ 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;
2682
+ return $[0] !== datasets || $[1] !== defaultDataset || $[2] !== projectId || $[3] !== props ? (t1 = /* @__PURE__ */ jsx(VisionGui, {
2681
2683
  ...props,
2682
2684
  datasets,
2683
2685
  projectId,
2684
2686
  defaultDataset
2685
- }, projectId), $[14] = datasets, $[15] = defaultDataset, $[16] = projectId, $[17] = props, $[18] = t5) : t5 = $[18], t5;
2687
+ }, projectId), $[0] = datasets, $[1] = defaultDataset, $[2] = projectId, $[3] = props, $[4] = t1) : t1 = $[4], t1;
2686
2688
  }
2687
2689
  /**
2688
2690
  * @internal
@@ -2766,4 +2768,4 @@ function SanityVision(props) {
2766
2768
  }
2767
2769
  export { SanityVision as default };
2768
2770
 
2769
- //# sourceMappingURL=SanityVision-MCdLivbU.js.map
2771
+ //# sourceMappingURL=SanityVision-CQ0yUM4l.js.map