@sanity/assist 1.2.10 → 1.2.12
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.js
CHANGED
|
@@ -3636,8 +3636,7 @@ const InlineBlockValueContext = react.createContext(void 0);
|
|
|
3636
3636
|
function AssistInlineFormBlock(props) {
|
|
3637
3637
|
return /* @__PURE__ */jsxRuntime.jsx(InlineBlockValueContext.Provider, {
|
|
3638
3638
|
value: props.value,
|
|
3639
|
-
children: /* @__PURE__ */jsxRuntime.jsx(
|
|
3640
|
-
flex: 1,
|
|
3639
|
+
children: /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3641
3640
|
children: props.renderDefault(props)
|
|
3642
3641
|
})
|
|
3643
3642
|
});
|
|
@@ -4311,7 +4310,8 @@ function ImageContextProvider(props) {
|
|
|
4311
4310
|
const assetRef = (_a = value == null ? void 0 : value.asset) == null ? void 0 : _a._ref;
|
|
4312
4311
|
const [assetRefState, setAssetRefState] = react.useState(assetRef);
|
|
4313
4312
|
const {
|
|
4314
|
-
documentId
|
|
4313
|
+
documentId,
|
|
4314
|
+
documentSchemaType
|
|
4315
4315
|
} = useAssistDocumentContext();
|
|
4316
4316
|
const {
|
|
4317
4317
|
config
|
|
@@ -4320,16 +4320,19 @@ function ImageContextProvider(props) {
|
|
|
4320
4320
|
const {
|
|
4321
4321
|
generateCaption
|
|
4322
4322
|
} = useGenerateCaption(apiClient);
|
|
4323
|
+
const {
|
|
4324
|
+
isSyncing
|
|
4325
|
+
} = sanity.useSyncState(publicId(documentId), documentSchemaType.name);
|
|
4323
4326
|
react.useEffect(() => {
|
|
4324
4327
|
const captionField = getCaptionFieldOption(schemaType);
|
|
4325
|
-
if (assetRef && documentId && captionField && assetRef !== assetRefState) {
|
|
4328
|
+
if (assetRef && documentId && captionField && assetRef !== assetRefState && !isSyncing) {
|
|
4326
4329
|
setAssetRefState(assetRef);
|
|
4327
4330
|
generateCaption({
|
|
4328
4331
|
path: sanity.pathToString([...path, captionField]),
|
|
4329
4332
|
documentId
|
|
4330
4333
|
});
|
|
4331
4334
|
}
|
|
4332
|
-
}, [schemaType, path, assetRef, assetRefState, documentId, generateCaption]);
|
|
4335
|
+
}, [schemaType, path, assetRef, assetRefState, documentId, generateCaption, isSyncing]);
|
|
4333
4336
|
const context = react.useMemo(() => {
|
|
4334
4337
|
const captionField = getCaptionFieldOption(schemaType);
|
|
4335
4338
|
return captionField ? {
|