sanity-plugin-workflow 1.0.0-beta.10 → 1.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-workflow",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "A demonstration of a custom content publishing workflow using Sanity.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -35,9 +35,7 @@ export function AssignWorkflow(props: DocumentActionProps) {
35
35
  content: (
36
36
  <UserAssignment
37
37
  userList={userList}
38
- assignees={
39
- metadata && metadata.assignees.length > 0 ? metadata.assignees : []
40
- }
38
+ assignees={metadata?.assignees?.length > 0 ? metadata.assignees : []}
41
39
  documentId={id}
42
40
  />
43
41
  ),
@@ -80,7 +80,7 @@ export function UpdateWorkflow(props: DocumentActionProps, actionState: State) {
80
80
  actionState?.roles?.length !== 0
81
81
 
82
82
  const actionStateIsAValidTransition =
83
- currentState?.id && currentState.transitions.length
83
+ currentState?.id && currentState?.transitions?.length
84
84
  ? // If the Current State limits transitions to specific States
85
85
  // Check that the Action State is in Current State's transitions array
86
86
  currentState.transitions.includes(actionState.id)
@@ -90,7 +90,7 @@ export function UpdateWorkflow(props: DocumentActionProps, actionState: State) {
90
90
  const userAssignmentCanUpdateState = actionState.requireAssignment
91
91
  ? // If the Action State requires assigned users
92
92
  // Check the current user ID is in the assignees array
93
- currentUser && assignees.length && assignees.includes(currentUser.id)
93
+ currentUser && assignees?.length && assignees.includes(currentUser.id)
94
94
  : // Otherwise this isn't a problem
95
95
  true
96
96