@sanity/embeddings-index-ui

4.0.64.0.7
dist/index.js
~dist/index.jsModified
+4−3
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -459,9 +459,9 @@
 			filter: { type: typeFilter }
 		}, client).then((result) => {
 			if (queryRef.current === queryString) {
 				setSearching(!1), setOptions([]);
-				let resultOptions = result.filter((hit) => filterResult ? filterResult(hit) : !0).map(_temp$2);
+				let resultOptions = result.filter((hit) => !filterResult || filterResult(hit)).map(_temp$2);
 				resultOptions.length ? setOptions(resultOptions) : setOptions([{ value: "" }]);
 			}
 		}).catch((e) => {
 			console.error(e), queryRef.current === queryString && (setSearching(!1), setOptions([{ value: "" }]));
@@ -1110,15 +1110,16 @@
 		if (!result) {
 			onChange(unset()), onPathFocus([]);
 			return;
 		}
-		onChange([
+		let patches = [
 			setIfMissing({}),
 			set(schemaType.name, ["_type"]),
 			set(publicId(result.value.documentId), ["_ref"]),
 			unset(["_weak"]),
 			unset(["_strengthenOnPublish"])
-		]), onPathFocus([]);
+		];
+		onChange(patches), onPathFocus([]);
 	}, [
 		onChange,
 		onPathFocus,
 		schemaType.name