Skip to content

Commit 276d566

Browse files
committed
fix(react): find correct instance for hooks that use config
1 parent 5fbd500 commit 276d566

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react/src/hooks/preview/useDocumentPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function useDocumentPreview({
8383
ref,
8484
...docHandle
8585
}: useDocumentPreviewOptions): useDocumentPreviewResults {
86-
const instance = useSanityInstance()
86+
const instance = useSanityInstance(docHandle)
8787
const stateSource = getPreviewState(instance, docHandle)
8888

8989
// Create subscribe function for useSyncExternalStore

packages/react/src/hooks/projection/useDocumentProjection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export function useDocumentProjection<TData extends object>({
181181
projection,
182182
...docHandle
183183
}: useDocumentProjectionOptions): useDocumentProjectionResults<TData> {
184-
const instance = useSanityInstance()
184+
const instance = useSanityInstance(docHandle)
185185
const stateSource = getProjectionState<TData>(instance, {...docHandle, projection})
186186

187187
if (stateSource.getCurrent()?.data === null) {

0 commit comments

Comments
 (0)