Closed creative-andrew closed 1 year ago
How to reproduce:
Go to the demo site and create a new post.
Add in the Page layout a content block.
Add a link to the content block first using Internal link as type .
Save and the response should be like this including the corresponding reference object.
"links": [ { "link": { "type": "reference", "label": "fdfdfd", "reference": { "value": { "id": "64cb7aa12ad37e39db23ecef", "hero": { "type": "contentMedia", "basic": { }, "content": { }, "contentMedia": { "links": [ { "link": { "appearance": "text", "type": "custom", "label": "Documentation", "reference": null, "url": "https://payloadcms.com/docs/getting-started/what-is-payload" }, "id": "61f9b0479d0e9c0b6424c3e0" } ], "media": "64cb7aa12ad37e39db23ecd9", "embeddedVideo": { "embed": true, "poster": "64cb7aa12ad37e39db23ecd9", "platform": "youtube", "videoID": "bxWsZTtqs80", "aspectRatio": "56.25" } }, "contentSidebar": { }, "fullscreenBackground": { }, "quickNav": { }, "fullscreenSlider": { } }, "author": "64cb7aa12ad37e39db23ecd6", "parent": "64cb7aa12ad37e39db23ecdb", "meta": { }, "_status": "published", "createdAt": "2023-08-03T10:00:02.007Z", "updatedAt": "2023-08-03T10:00:03.573Z" }, "relationTo": "pages" } }, "id": "64cb85283ae7938606124ba8" } ],
Modify the link to custom type and save. You will notice that the reference is still saved in the field even tho we are using a custom-type link
"links": [ { "link": { "type": "custom", "label": "fdfdfd", "reference": { "value": { "id": "64cb7aa12ad37e39db23ecef", "hero": { "type": "contentMedia", "basic": { }, "content": { }, "contentMedia": { "links": [ { "link": { "appearance": "text", "type": "custom", "label": "Documentation", "reference": null, "url": "https://payloadcms.com/docs/getting-started/what-is-payload" }, "id": "61f9b0479d0e9c0b6424c3e0" } ], "media": "64cb7aa12ad37e39db23ecd9", "embeddedVideo": { "embed": true, "poster": "64cb7aa12ad37e39db23ecd9", "platform": "youtube", "videoID": "bxWsZTtqs80", "aspectRatio": "56.25" } }, "contentSidebar": { }, "fullscreenBackground": { }, "quickNav": { }, "fullscreenSlider": { } }, "author": "64cb7aa12ad37e39db23ecd6", "parent": "64cb7aa12ad37e39db23ecdb", "meta": { }, "_status": "published", "createdAt": "2023-08-03T10:00:02.007Z", "updatedAt": "2023-08-03T10:00:03.573Z" }, "relationTo": "pages" }, "url": "dfddf" }, "id": "64cb85283ae7938606124ba8" } ],
Props: @italodr
I think this is a good change, cuts down on the response object/size too.
How to reproduce:
Go to the demo site and create a new post.
Add in the Page layout a content block.
Add a link to the content block first using Internal link as type .
Save and the response should be like this including the corresponding reference object.
Modify the link to custom type and save. You will notice that the reference is still saved in the field even tho we are using a custom-type link
Props: @italodr