@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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/sdk-react",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Sanity SDK React toolkit for Content OS",
|
|
6
6
|
"keywords": [
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
"@sanity/types": "^3.83.0",
|
|
48
48
|
"@types/lodash-es": "^4.17.12",
|
|
49
49
|
"lodash-es": "^4.17.21",
|
|
50
|
+
"react-compiler-runtime": "19.0.0-beta-ebf51a3-20250411",
|
|
50
51
|
"react-error-boundary": "^5.0.0",
|
|
51
52
|
"rxjs": "^7.8.2",
|
|
52
|
-
"@sanity/sdk": "0.0.0-alpha.
|
|
53
|
+
"@sanity/sdk": "0.0.0-alpha.27"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@sanity/browserslist-config": "^1.0.5",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"@types/react-dom": "^19.1.1",
|
|
64
65
|
"@vitejs/plugin-react": "^4.3.4",
|
|
65
66
|
"@vitest/coverage-v8": "3.1.1",
|
|
66
|
-
"babel-plugin-react-compiler": "19.0.0-beta-
|
|
67
|
+
"babel-plugin-react-compiler": "19.0.0-beta-ebf51a3-20250411",
|
|
67
68
|
"eslint": "^9.22.0",
|
|
68
69
|
"jsdom": "^25.0.1",
|
|
69
70
|
"prettier": "^3.5.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createSanityInstance, type SanityConfig, type SanityInstance} from '@sanity/sdk'
|
|
2
|
-
import {Suspense,
|
|
2
|
+
import {Suspense, useContext, useEffect, useMemo, useRef} from 'react'
|
|
3
3
|
|
|
4
4
|
import {SanityInstanceContext} from './SanityInstanceContext'
|
|
5
5
|
|
|
@@ -72,7 +72,7 @@ export function ResourceProvider({
|
|
|
72
72
|
fallback,
|
|
73
73
|
...config
|
|
74
74
|
}: ResourceProviderProps): React.ReactNode {
|
|
75
|
-
const parent =
|
|
75
|
+
const parent = useContext(SanityInstanceContext)
|
|
76
76
|
const instance = useMemo(
|
|
77
77
|
() => (parent ? parent.createChild(config) : createSanityInstance(config)),
|
|
78
78
|
[config, parent],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {type SanityConfig, type SanityInstance} from '@sanity/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import {useContext} from 'react'
|
|
3
3
|
|
|
4
4
|
import {SanityInstanceContext} from '../../context/SanityInstanceContext'
|
|
5
5
|
|
|
@@ -58,7 +58,7 @@ import {SanityInstanceContext} from '../../context/SanityInstanceContext'
|
|
|
58
58
|
* @throws Error if no matching instance is found for the provided config
|
|
59
59
|
*/
|
|
60
60
|
export const useSanityInstance = (config?: SanityConfig): SanityInstance => {
|
|
61
|
-
const instance =
|
|
61
|
+
const instance = useContext(SanityInstanceContext)
|
|
62
62
|
|
|
63
63
|
if (!instance) {
|
|
64
64
|
throw new Error(
|