@sanity/assist 4.0.0 → 4.0.2

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/assist",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "You create the instructions; Sanity AI Assist does the rest.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -33,14 +33,11 @@ export function useAssistDocumentContextValue(documentId: string, documentType:
33
33
  // @ts-ignore this is a valid option available in `corel` - Remove after corel is merged to next
34
34
  const {draft, published, version} = editState || {}
35
35
 
36
- let assistableDocumentId = version?._id || draft?._id || published?._id
37
- if (!assistableDocumentId) {
38
- assistableDocumentId = selectedReleaseId
39
- ? getVersionId(documentId, selectedReleaseId)
40
- : documentSchemaType.liveEdit
41
- ? documentId
42
- : getDraftId(documentId)
43
- }
36
+ const assistableDocumentId = selectedReleaseId
37
+ ? getVersionId(documentId, selectedReleaseId)
38
+ : documentSchemaType.liveEdit
39
+ ? documentId
40
+ : getDraftId(documentId)
44
41
 
45
42
  const documentIsNew = selectedReleaseId ? !version?._id : !draft?._id && !published?._id
46
43
  const documentIsAssistable = selectedReleaseId
@@ -148,7 +148,10 @@ export const translateActions: DocumentFieldAction = {
148
148
  getConditionalMembers(formStateRef.current)
149
149
  }
150
150
  openFieldTranslation({
151
- document: docRef.current,
151
+ document: {
152
+ ...docRef.current,
153
+ _id: documentId,
154
+ },
152
155
  documentSchema: documentSchemaType,
153
156
  translatePath: path,
154
157
  conditionalMembers: formStateRef.current