@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.js
CHANGED
|
@@ -1017,7 +1017,13 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1017
1017
|
if (!schemaType)
|
|
1018
1018
|
throw new Error(`Schema type "${documentType}" not found`);
|
|
1019
1019
|
return schemaType;
|
|
1020
|
-
}, [documentType, schema]), {
|
|
1020
|
+
}, [documentType, schema]), { fieldRefs, fieldRefsByTypePath } = react.useMemo(() => {
|
|
1021
|
+
const fieldRefs2 = getFieldRefs(documentSchemaType), fieldRefsByTypePath2 = asFieldRefsByTypePath(fieldRefs2);
|
|
1022
|
+
return {
|
|
1023
|
+
fieldRefs: fieldRefs2,
|
|
1024
|
+
fieldRefsByTypePath: fieldRefsByTypePath2
|
|
1025
|
+
};
|
|
1026
|
+
}, [documentSchemaType]), {
|
|
1021
1027
|
openInspector,
|
|
1022
1028
|
closeInspector,
|
|
1023
1029
|
inspector,
|
|
@@ -1029,7 +1035,7 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1029
1035
|
} = structure.useDocumentPane(), { draft, published, version } = editState || {}, assistableDocumentId = selectedReleaseId ? sanity.getVersionId(documentId, selectedReleaseId) : documentSchemaType.liveEdit ? documentId : sanity.getDraftId(documentId), documentIsNew = selectedReleaseId ? !version?._id : !draft?._id && !published?._id, documentIsAssistable = selectedReleaseId ? !!version : isDocAssistable(documentSchemaType, published, draft), { params } = useAiPaneRouter(), selectedPath = params[fieldPathParam], assistDocument = useStudioAssistDocument({
|
|
1030
1036
|
documentId: assistableDocumentId,
|
|
1031
1037
|
schemaType: documentSchemaType
|
|
1032
|
-
}), { syntheticTasks, addSyntheticTask, removeSyntheticTask } = useSyntheticTasks(assistableDocumentId)
|
|
1038
|
+
}), { syntheticTasks, addSyntheticTask, removeSyntheticTask } = useSyntheticTasks(assistableDocumentId);
|
|
1033
1039
|
return react.useMemo(() => {
|
|
1034
1040
|
const base = {
|
|
1035
1041
|
assistableDocumentId,
|
|
@@ -1065,7 +1071,9 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1065
1071
|
selectedPath,
|
|
1066
1072
|
syntheticTasks,
|
|
1067
1073
|
addSyntheticTask,
|
|
1068
|
-
removeSyntheticTask
|
|
1074
|
+
removeSyntheticTask,
|
|
1075
|
+
fieldRefs,
|
|
1076
|
+
fieldRefsByTypePath
|
|
1069
1077
|
]);
|
|
1070
1078
|
}
|
|
1071
1079
|
function useSyntheticTasks(assistableDocumentId) {
|