@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/dist/index.esm.js +11 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assistDocument/hooks/useAssistDocumentContextValue.tsx +11 -3
package/dist/index.mjs
CHANGED
|
@@ -1024,7 +1024,13 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1024
1024
|
if (!schemaType)
|
|
1025
1025
|
throw new Error(`Schema type "${documentType}" not found`);
|
|
1026
1026
|
return schemaType;
|
|
1027
|
-
}, [documentType, schema]), {
|
|
1027
|
+
}, [documentType, schema]), { fieldRefs, fieldRefsByTypePath } = useMemo(() => {
|
|
1028
|
+
const fieldRefs2 = getFieldRefs(documentSchemaType), fieldRefsByTypePath2 = asFieldRefsByTypePath(fieldRefs2);
|
|
1029
|
+
return {
|
|
1030
|
+
fieldRefs: fieldRefs2,
|
|
1031
|
+
fieldRefsByTypePath: fieldRefsByTypePath2
|
|
1032
|
+
};
|
|
1033
|
+
}, [documentSchemaType]), {
|
|
1028
1034
|
openInspector,
|
|
1029
1035
|
closeInspector,
|
|
1030
1036
|
inspector,
|
|
@@ -1036,7 +1042,7 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1036
1042
|
} = useDocumentPane(), { draft, published, version } = editState || {}, assistableDocumentId = selectedReleaseId ? getVersionId(documentId, selectedReleaseId) : documentSchemaType.liveEdit ? documentId : getDraftId(documentId), documentIsNew = selectedReleaseId ? !version?._id : !draft?._id && !published?._id, documentIsAssistable = selectedReleaseId ? !!version : isDocAssistable(documentSchemaType, published, draft), { params } = useAiPaneRouter(), selectedPath = params[fieldPathParam], assistDocument = useStudioAssistDocument({
|
|
1037
1043
|
documentId: assistableDocumentId,
|
|
1038
1044
|
schemaType: documentSchemaType
|
|
1039
|
-
}), { syntheticTasks, addSyntheticTask, removeSyntheticTask } = useSyntheticTasks(assistableDocumentId)
|
|
1045
|
+
}), { syntheticTasks, addSyntheticTask, removeSyntheticTask } = useSyntheticTasks(assistableDocumentId);
|
|
1040
1046
|
return useMemo(() => {
|
|
1041
1047
|
const base = {
|
|
1042
1048
|
assistableDocumentId,
|
|
@@ -1072,7 +1078,9 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1072
1078
|
selectedPath,
|
|
1073
1079
|
syntheticTasks,
|
|
1074
1080
|
addSyntheticTask,
|
|
1075
|
-
removeSyntheticTask
|
|
1081
|
+
removeSyntheticTask,
|
|
1082
|
+
fieldRefs,
|
|
1083
|
+
fieldRefsByTypePath
|
|
1076
1084
|
]);
|
|
1077
1085
|
}
|
|
1078
1086
|
function useSyntheticTasks(assistableDocumentId) {
|