sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
13 lines (10 loc) • 430 B
text/typescript
import {useMemoObservable} from 'react-rx'
import {type OperationsAPI, useDocumentStore} from '../store'
/** @internal */
export function useDocumentOperation(publishedDocId: string, docTypeName: string): OperationsAPI {
const documentStore = useDocumentStore()
return useMemoObservable(
() => documentStore.pair.editOperations(publishedDocId, docTypeName),
[docTypeName, documentStore.pair, publishedDocId],
)!
}