sanity-plugin-workflow

3.0.293.0.30
~

Modified (4 files)

Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -172,9 +172,9 @@
 	if (!metadata || currentState && currentState.id === actionState.id) return null;
 	let currentStateIndex = states.findIndex((s_0) => s_0.id === currentState?.id), direction = states.findIndex((s_1) => s_1.id === actionState.id) > currentStateIndex ? "promote" : "demote", DirectionIcon = direction === "promote" ? ArrowRightIcon : ArrowLeftIcon, directionLabel = direction === "promote" ? "Promote" : "Demote", t7;
 	$[10] !== actionState.roles || $[11] !== user ? (t7 = user?.roles?.length && actionState?.roles?.length ? arraysContainMatchingString(user.roles.map(_temp2$3), actionState.roles) : actionState?.roles?.length !== 0, $[10] = actionState.roles, $[11] = user, $[12] = t7) : t7 = $[12];
 	let userRoleCanUpdateState = t7, actionStateIsAValidTransition = currentState?.id && currentState?.transitions?.length ? currentState.transitions.includes(actionState.id) : !0, t8;
-	$[13] !== actionState.requireAssignment || $[14] !== assignees || $[15] !== currentUser ? (t8 = actionState.requireAssignment ? currentUser && assignees?.length && assignees.includes(currentUser.id) : !0, $[13] = actionState.requireAssignment, $[14] = assignees, $[15] = currentUser, $[16] = t8) : t8 = $[16];
+	$[13] !== actionState.requireAssignment || $[14] !== assignees || $[15] !== currentUser ? (t8 = !actionState.requireAssignment || currentUser && assignees?.length && assignees.includes(currentUser.id), $[13] = actionState.requireAssignment, $[14] = assignees, $[15] = currentUser, $[16] = t8) : t8 = $[16];
 	let userAssignmentCanUpdateState = t8, title = `${directionLabel} State to "${actionState.title}"`;
 	userRoleCanUpdateState ? actionStateIsAValidTransition ? userAssignmentCanUpdateState ? currentState?.requireValidation && isValidating ? title = `Document is validating, cannot ${directionLabel} State to "${actionState.title}"` : hasValidationErrors && (title = `Document has validation errors, cannot ${directionLabel} State to "${actionState.title}"`) : title = `You must be assigned to the document to ${directionLabel} State to "${actionState.title}"` : title = `You cannot ${directionLabel} State to "${actionState.title}" from "${currentState?.title}"` : title = `Your User role cannot ${directionLabel} State to "${actionState.title}"`;
 	let t9 = loading || !!error || currentState?.requireValidation && isValidating || !!hasValidationErrors || !currentState || !userRoleCanUpdateState || !actionStateIsAValidTransition || !userAssignmentCanUpdateState, t10;
 	$[17] !== actionState || $[18] !== id || $[19] !== onHandle ? (t10 = () => onHandle(id, actionState), $[17] = actionState, $[18] = id, $[19] = onHandle, $[20] = t10) : t10 = $[20];
@@ -414,9 +414,9 @@
 	let t3;
 	return $[7] === props ? t3 = $[8] : (t3 = props.renderDefault(props), $[7] = props, $[8] = t3), t3;
 }
 function EditButton(props) {
-	let $ = c(7), { id, type, disabled: t0 } = props, disabled = t0 === void 0 ? !1 : t0, { navigateIntent } = useRouter(), t1;
+	let $ = c(7), { id, type, disabled: t0 } = props, disabled = t0 !== void 0 && t0, { navigateIntent } = useRouter(), t1;
 	$[0] !== id || $[1] !== navigateIntent || $[2] !== type ? (t1 = () => navigateIntent("edit", {
 		id,
 		type
 	}), $[0] = id, $[1] = navigateIntent, $[2] = type, $[3] = t1) : t1 = $[3];
@@ -570,18 +570,18 @@
 		data && setLocalDocuments(data);
 	}, t6 = [data], $[7] = data, $[8] = t5, $[9] = t6), useEffect(t5, t6);
 	let t7;
 	$[10] !== client || $[11] !== localDocuments || $[12] !== toast ? (t7 = async (draggedId, destination, states, newOrder) => {
-		let currentLocalData = localDocuments;
-		setLocalDocuments(localDocuments.map((item) => item?._metadata?.documentId === draggedId ? {
+		let currentLocalData = localDocuments, newLocalDocuments = localDocuments.map((item) => item?._metadata?.documentId === draggedId ? {
 			...item,
 			_metadata: {
 				...item._metadata,
 				state: destination.droppableId,
 				orderRank: newOrder,
 				optimistic: !0
 			}
-		} : item));
+		} : item);
+		setLocalDocuments(newLocalDocuments);
 		let newStateId = destination.droppableId, newState = states.find((s) => s.id === newStateId), document = localDocuments.find((d) => d?._metadata?.documentId === draggedId);
 		if (!newState?.id) return toast.push({
 			title: `Could not find target state ${newStateId}`,
 			status: "error"
@@ -666,9 +666,9 @@
 		children: /* @__PURE__ */ jsx(UserAvatar, { user })
 	}, user.id);
 }
 function UserDisplay(props) {
-	let $ = c(15), { assignees, userList, documentId, disabled: t0 } = props, disabled = t0 === void 0 ? !1 : t0, buttonRef = useRef(null), popoverRef = useRef(null), [isOpen, setIsOpen] = useState(!1), t1;
+	let $ = c(15), { assignees, userList, documentId, disabled: t0 } = props, disabled = t0 !== void 0 && t0, buttonRef = useRef(null), popoverRef = useRef(null), [isOpen, setIsOpen] = useState(!1), t1;
 	$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setIsOpen(!1), $[0] = t1) : t1 = $[0];
 	let close = t1, t2;
 	$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setIsOpen(!0), $[1] = t2) : t2 = $[1];
 	let open = t2, t3;
@@ -708,9 +708,9 @@
 		children: t5
 	}), $[11] = isOpen, $[12] = t4, $[13] = t5, $[14] = t6) : t6 = $[14], t6;
 }
 function CompleteButton(props) {
-	let $ = c(9), { documentId, disabled: t0 } = props, disabled = t0 === void 0 ? !1 : t0, t1;
+	let $ = c(9), { documentId, disabled: t0 } = props, disabled = t0 !== void 0 && t0, t1;
 	$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { apiVersion: API_VERSION }, $[0] = t1) : t1 = $[0];
 	let client = useClient(t1), toast = useToast(), t2;
 	$[1] !== client || $[2] !== toast ? (t2 = async (event) => {
 		let id = event.currentTarget.value;
@@ -894,9 +894,9 @@
 		toggleInvalidDocumentId,
 		validation
 	], $[13] = documentId, $[14] = isValidating, $[15] = toggleInvalidDocumentId, $[16] = validation, $[17] = t10, $[18] = t9) : (t10 = $[17], t9 = $[18]), useEffect(t9, t10);
 	let t11;
-	$[19] !== isValidating || $[20] !== validation ? (t11 = isValidating ? !1 : validation.some(_temp3$2), $[19] = isValidating, $[20] = validation, $[21] = t11) : t11 = $[21];
+	$[19] !== isValidating || $[20] !== validation ? (t11 = !isValidating && validation.some(_temp3$2), $[19] = isValidating, $[20] = validation, $[21] = t11) : t11 = $[21];
 	let hasError = t11, isLastState = states?.[states?.length - 1]?.id === item._metadata?.state, t12;
 	$[22] !== documentId || $[23] !== item._type || $[24] !== state?.requireValidation ? (t12 = state?.requireValidation ? /* @__PURE__ */ jsx(Validate, {
 		documentId,
 		type: item._type,
@@ -1627,9 +1627,9 @@
 		selectedSchemaTypes,
 		toggleSelectedSchemaType
 	}), $[39] = schemaTypes, $[40] = selectedSchemaTypes, $[41] = selectedUserIds, $[42] = uniqueAssignedUsers, $[43] = t22) : t22 = $[43];
 	let T1 = DragDropContext, T2 = Grid, t23 = states.length, t25 = states.map((state_0, stateIndex) => {
-		let userRoleCanDrop = state_0?.roles?.length ? arraysContainMatchingString(state_0.roles, userRoleNames) : !0, isDropDisabled = !userRoleCanDrop || undroppableStates.includes(state_0.id);
+		let userRoleCanDrop = !state_0?.roles?.length || arraysContainMatchingString(state_0.roles, userRoleNames), isDropDisabled = !userRoleCanDrop || undroppableStates.includes(state_0.id);
 		return /* @__PURE__ */ jsx(Card, {
 			borderLeft: stateIndex > 0,
 			tone: defaultCardTone,
 			children: /* @__PURE__ */ jsxs(Flex, {
Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "sanity-plugin-workflow",
-  "version": "3.0.29",
+  "version": "3.0.30",
   "description": "A demonstration of a custom content publishing workflow using Sanity.",
   "keywords": [
     "sanity",
     "sanity-plugin"
@@ -28,24 +28,24 @@
   },
   "dependencies": {
     "@hello-pangea/dnd": "^18.0.1",
     "@sanity/icons": "^5.0.0",
-    "@sanity/ui": "^3.3.0",
-    "@tanstack/react-virtual": "^3.14.4",
+    "@sanity/ui": "^3.3.5",
+    "@tanstack/react-virtual": "^3.14.5",
     "lexorank": "^1.0.5",
     "motion": "^12.42.2",
-    "sanity-plugin-utils": "^2.0.6"
+    "sanity-plugin-utils": "^2.0.7"
   },
   "devDependencies": {
     "@sanity/tsconfig": "^2.2.0",
-    "@sanity/tsdown-config": "^0.11.0",
-    "@types/node": "^24.13.2",
+    "@sanity/tsdown-config": "^0.13.1",
+    "@types/node": "^24.13.3",
     "@types/react": "^19.2.17",
     "babel-plugin-react-compiler": "^1.0.0",
     "react": "^19.2.7",
     "sanity": "^6.3.0",
     "styled-components": "^6.4.3",
-    "tsdown": "^0.22.3"
+    "tsdown": "^0.22.5"
   },
   "peerDependencies": {
     "react": "^19.2",
     "sanity": "^5 || ^6.0.0-0",
Index: package/dist/index.d.ts.map
===================================================================
--- package/dist/index.d.ts.map
+++ package/dist/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/index.ts","../src/plugin.tsx"],"mappings":";KAEY,KAAA;EACV,EAAA;EACA,WAAA;EACA,KAAA;EACA,KAAA;EACA,iBAAA;EACA,iBAAA;EAEA,KAAA;AAAA;AAAA,KAGU,UAAA;EACV,EAAA,EAAI,EAAA;EAEJ,WAAA,GAAc,MAAA;IAAgB,EAAA;EAAA,MAAmB,GAAA;AAAA,IAC/C,KAAA;AAAA,KAEQ,cAAA;EACV,WAAA;EACA,MAAA,GAAS,KAAK;AAAA;AAAA,iBAGA,YAAA,mCAA+C,UAAA,CAAW,EAAA,EAAI,MAAA,KAC5E,MAAA,EAAQ,MAAA,GACP,MAAA;AAAA,cCXU,QAAA,EAAU,MAAM,CAAC,cAAA"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/index.ts","../src/plugin.tsx"],"mappings":";KAEY;EACV;EACA;EACA;EACA;EACA;EACA;EAEA;;KAGU,WAAW,IAAI;EACzB,IAAI;EAEJ,cAAc;IAAgB,UAAU;QAAS;IAC/C;KAEQ;EACV;EACA,SAAS;;iBAGK,aAAa,mBAAmB,eAAe,WAAW,IAAI,WAC5E,QAAQ,SACP;cCXU,UAAU,OAAO"}
\ No newline at end of file
File too large for inline diff