Skip to content

Commit 4c6afb2

Browse files
authored
docs: update useDocumentPreview reference doc (#566)
1 parent cf87532 commit 4c6afb2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,31 @@ export interface useDocumentPreviewOptions extends DocumentHandle {
2121
* @category Types
2222
*/
2323
export interface useDocumentPreviewResults {
24-
/** The results of resolving the document’s preview values */
24+
/** The results of inferring the document’s preview values */
2525
data: PreviewValue
26-
/** True when preview values are being refreshed */
26+
/** True when inferred preview values are being refreshed */
2727
isPending: boolean
2828
}
2929

3030
/**
3131
* @public
3232
*
33-
* Returns the preview values of a document (specified via a `DocumentHandle`),
33+
* Attempts to infer preview values of a document (specified via a `DocumentHandle`),
3434
* including the document’s `title`, `subtitle`, `media`, and `status`. These values are live and will update in realtime.
3535
* To reduce unnecessary network requests for resolving the preview values, an optional `ref` can be passed to the hook so that preview
3636
* resolution will only occur if the `ref` is intersecting the current viewport.
3737
*
38+
* See remarks below for futher information.
39+
*
40+
* @remarks
41+
* Values returned by this hook may not be as expected. It is currently unable to read preview values as defined in your schema;
42+
* instead, it attempts to infer these preview values by checking against a basic set of potential fields on your document.
43+
* We are anticipating being able to significantly improve this hook’s functionality and output in a future release.
44+
* For now, we recommend using {@link useDocumentProjection} for rendering individual document fields (or projections of those fields).
45+
*
3846
* @category Documents
39-
* @param options - The document handle for the document you want to resolve preview values for, and an optional ref
40-
* @returns The preview values for the given document and a boolean to indicate whether the resolution is pending
47+
* @param options - The document handle for the document you want to infer preview values for, and an optional ref
48+
* @returns The inferred values for the given document and a boolean to indicate whether the resolution is pending
4149
*
4250
* @example Combining with useDocuments to render a collection of document previews
4351
* ```

0 commit comments

Comments
 (0)