@sanity/sdk-react 0.0.0-alpha.26 → 0.0.0-alpha.27

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,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { c as c$3 } from "react/compiler-runtime";
2
+ import { c as c$3 } from "react-compiler-runtime";
3
3
  import { getAuthState, getLoginUrlState, handleAuthCallback, logout, AuthStateType, createSanityInstance, getTokenState, getCurrentUserState, getDashboardOrganizationId, getClientState, getOrCreateController, getOrCreateChannel, releaseChannel, getOrCreateNode, releaseNode, resolveDatasets, getDatasetsState, applyDocumentActions, resolveDocument, getDocumentState, subscribeDocumentEvents, getPermissionsState, getDocumentSyncStatus, editDocument, getQueryKey, parseQueryKey, getQueryState, resolveQuery, createGroqSearchFilter, getPreviewState, resolvePreview, getProjectionState, resolveProjection, resolveProject, getProjectState, resolveProjects, getProjectsState, getUsersKey, parseUsersKey, getUsersState, resolveUsers, loadMoreUsers } from "@sanity/sdk";
4
- import { createContext, use, useSyncExternalStore, useEffect, useState, useRef, Suspense, useInsertionEffect, useTransition, useMemo, useCallback } from "react";
4
+ import { createContext, useContext, useSyncExternalStore, useEffect, useState, useRef, Suspense, useInsertionEffect, useTransition, useMemo, useCallback } from "react";
5
5
  import { ErrorBoundary } from "react-error-boundary";
6
6
  import require$$0, { Readable } from "stream";
7
7
  import require$$1 from "zlib";
@@ -36,11 +36,14 @@ function _mergeNamespaces(n2, m2) {
36
36
  }), Object.freeze(n2);
37
37
  }
38
38
  const SanityInstanceContext = createContext(null), useSanityInstance = (config) => {
39
- const instance = use(SanityInstanceContext);
39
+ const $ = c$3(3), instance = useContext(SanityInstanceContext);
40
40
  if (!instance)
41
41
  throw new Error(`SanityInstance context not found. ${config ? `Requested config: ${JSON.stringify(config, null, 2)}. ` : ""}Please ensure that your component is wrapped in a <ResourceProvider> or a <SanityApp>.`);
42
- if (!config) return instance;
43
- const match = instance.match(config);
42
+ if (!config)
43
+ return instance;
44
+ let t0;
45
+ $[0] !== config || $[1] !== instance ? (t0 = instance.match(config), $[0] = config, $[1] = instance, $[2] = t0) : t0 = $[2];
46
+ const match = t0;
44
47
  if (!match)
45
48
  throw new Error(`Could not find a matching Sanity instance for the requested configuration: ${JSON.stringify(config, null, 2)}.
46
49
  Please ensure there is a <ResourceProvider> with a matching configuration in the component hierarchy.`);
@@ -4954,7 +4957,7 @@ function ResourceProvider(t0) {
4954
4957
  fallback,
4955
4958
  ...config
4956
4959
  } = t0, $[0] = t0, $[1] = children, $[2] = config, $[3] = fallback) : (children = $[1], config = $[2], fallback = $[3]);
4957
- const parent = use(SanityInstanceContext);
4960
+ const parent = useContext(SanityInstanceContext);
4958
4961
  let t1, t2;
4959
4962
  $[4] !== config || $[5] !== parent ? (t2 = parent ? parent.createChild(config) : createSanityInstance(config), $[4] = config, $[5] = parent, $[6] = t2) : t2 = $[6], t1 = t2;
4960
4963
  const instance = t1, disposal = useRef(null);
@@ -5765,7 +5768,7 @@ function useUsers(options) {
5765
5768
  loadMore
5766
5769
  };
5767
5770
  }
5768
- var version = "0.0.0-alpha.26";
5771
+ var version = "0.0.0-alpha.27";
5769
5772
  function getEnv(key) {
5770
5773
  if (typeof import.meta < "u" && import.meta.env)
5771
5774
  return import.meta.env[key];