@sanity/assist 4.4.3 → 4.4.4

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/assist",
3
- "version": "4.4.3",
3
+ "version": "4.4.4",
4
4
  "description": "You create the instructions; Sanity AI Assist does the rest.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -19,6 +19,15 @@ export function useAssistDocumentContextValue(documentId: string, documentType:
19
19
  return schemaType
20
20
  }, [documentType, schema])
21
21
 
22
+ const {fieldRefs, fieldRefsByTypePath} = useMemo(() => {
23
+ const fieldRefs = getFieldRefs(documentSchemaType)
24
+ const fieldRefsByTypePath = asFieldRefsByTypePath(fieldRefs)
25
+ return {
26
+ fieldRefs,
27
+ fieldRefsByTypePath,
28
+ }
29
+ }, [documentSchemaType])
30
+
22
31
  const {
23
32
  openInspector,
24
33
  closeInspector,
@@ -54,9 +63,6 @@ export function useAssistDocumentContextValue(documentId: string, documentType:
54
63
  const {syntheticTasks, addSyntheticTask, removeSyntheticTask} =
55
64
  useSyntheticTasks(assistableDocumentId)
56
65
 
57
- const fieldRefs = getFieldRefs(documentSchemaType)
58
- const fieldRefsByTypePath = asFieldRefsByTypePath(fieldRefs)
59
-
60
66
  const value: AssistDocumentContextValue = useMemo(() => {
61
67
  const base = {
62
68
  assistableDocumentId,
@@ -96,6 +102,8 @@ export function useAssistDocumentContextValue(documentId: string, documentType:
96
102
  syntheticTasks,
97
103
  addSyntheticTask,
98
104
  removeSyntheticTask,
105
+ fieldRefs,
106
+ fieldRefsByTypePath,
99
107
  ])
100
108
 
101
109
  return value