@sanity/assist

6.2.36.2.4
dist/index.js
~dist/index.jsModified
+13−27
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -895,19 +895,15 @@
 	let getUserInput = t0, t1;
 	$[1] !== loading || $[2] !== runInstructionRequest ? (t1 = (req) => {
 		if (loading) return;
 		let { instruction, ...request } = req, instructionKey = instruction._key, userInputBlocks_0 = instruction?.prompt?.flatMap(_temp2$8).filter(isUserInputBlock);
-		if (!userInputBlocks_0?.length) {
-			runInstructionRequest({
-				...request,
-				instructionKey,
-				userTexts: void 0
-			});
-			return;
-		}
-		setRunRequest({
+		userInputBlocks_0?.length ? setRunRequest({
 			...req,
 			userInputBlocks: userInputBlocks_0
+		}) : runInstructionRequest({
+			...request,
+			instructionKey,
+			userTexts: void 0
 		});
 	}, $[1] = loading, $[2] = runInstructionRequest, $[3] = t1) : t1 = $[3];
 	let runInstruction = t1, t2;
 	$[4] === resolveUserInput ? t2 = $[5] : (t2 = () => {
@@ -1113,13 +1109,9 @@
 	let t3;
 	$[7] !== isDocAssistable || $[8] !== isSyncing ? (t3 = [isDocAssistable, isSyncing], $[7] = isDocAssistable, $[8] = isSyncing, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
 	let t4;
 	return $[10] !== documentOnChange || $[11] !== isDocAssistable || $[12] !== isSyncing || $[13] !== task ? (t4 = (taskArgs) => {
-		if (isDocAssistable && !isSyncing) {
-			task(taskArgs);
-			return;
-		}
-		queuedRef.current = advance({
+		isDocAssistable && !isSyncing ? task(taskArgs) : queuedRef.current = advance({
 			args: taskArgs,
 			phase: "awaiting-sync",
 			attempts: 0
 		}, {
@@ -3698,21 +3690,15 @@
 					children: /* @__PURE__ */ jsx(Spinner, { style: { transform: "translateY(6px)" } })
 				}) : ImageIcon,
 				title: "Generate image description",
 				onAction: () => {
-					if (!loading) {
-						if (!canUseAssist(status)) {
-							openInspector(aiInspectorId, {
-								[fieldPathParam]: pathKey,
-								[instructionParam]: void 0
-							});
-							return;
-						}
-						generateCaptionWhenDraftReady({
-							path: pathKey,
-							documentId: assistableDocumentId
-						});
-					}
+					loading || (canUseAssist(status) ? generateCaptionWhenDraftReady({
+						path: pathKey,
+						documentId: assistableDocumentId
+					}) : openInspector(aiInspectorId, {
+						[fieldPathParam]: pathKey,
+						[instructionParam]: void 0
+					}));
 				},
 				renderAsButton: !0,
 				disabled: loading,
 				hidden: !imageContext.assetRef