Skip to content

Commit 1548ddc

Browse files
committed
Media editor: read original_attachment from the root of the response
The backend now exposes it as a root-level attachment field rather than inside media_details, since it describes a relationship between attachments (like post).
1 parent 62984dc commit 1548ddc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/media-editor/src/components/media-editor

‎packages/media-editor/src/components/media-editor/index.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,11 @@ function MediaEditorContent( {
562562
}, [ id, invalidateResolution ] );
563563

564564
// Restore-original: the lineage root the edited attachment descends from,
565-
// exposed by the server on `media_details.original_attachment`. Fetch its
565+
// exposed by the server as the root-level `original_attachment` field
566+
// on the attachment (edit context). Fetch its
566567
// record for the natural dimensions the cropper needs to seed itself (the
567568
// field itself carries only the id and url).
568-
const originalAttachment = media?.media_details?.original_attachment;
569+
const originalAttachment = media?.original_attachment;
569570
const originalId: number | undefined = originalAttachment?.attachment_id;
570571
const originalRecord = useSelect(
571572
( select ) =>

0 commit comments

Comments
 (0)