Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/ProductElement.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,14 @@ const product: ProductBlockElement = {
_type: 'model.dotcomrendering.pageElements.LinkBlockElement',
url: 'https://www.johnlewis.com/bosch-twk7203gb-sky-variable-temperature-kettle-1-7l-black/p3228625',
label: '£79.99 at John Lewis',
elementId: 'f9b3e7a9-788b-4ada-bd99-f7c40b843db7',
linkType: 'ProductButton',
},
{
_type: 'model.dotcomrendering.pageElements.LinkBlockElement',
url: 'https://www.amazon.co.uk/Bosch-TWK7203GB-Sky-Variable-Temperature/dp/B07Z8VQ2V6',
label: '£79.99 at Amazon',
elementId: 'f9b3e7a9-788b-4ada-bd99-f7c40b843db7',
linkType: 'ProductButton',
},
{
Expand Down
4 changes: 4 additions & 0 deletions dotcom-rendering/src/frontend/schemas/feArticle.json
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,9 @@
"type": "string",
"const": "model.dotcomrendering.pageElements.LinkBlockElement"
},
"elementId": {
"type": "string"
},
"url": {
"type": "string"
},
Expand All @@ -2528,6 +2531,7 @@
},
"required": [
"_type",
"elementId",
"label",
"linkType",
"url"
Expand Down
4 changes: 4 additions & 0 deletions dotcom-rendering/src/model/block-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,9 @@
"type": "string",
"const": "model.dotcomrendering.pageElements.LinkBlockElement"
},
"elementId": {
"type": "string"
},
"url": {
"type": "string"
},
Expand All @@ -2016,6 +2019,7 @@
},
"required": [
"_type",
"elementId",
"label",
"linkType",
"url"
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/types/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ export interface ListItem {

export interface LinkBlockElement {
_type: 'model.dotcomrendering.pageElements.LinkBlockElement';
elementId: string;
Copy link
Member

@arelra arelra Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will elementId be used for anything or is this PR to just align the types?

We have to be careful with elementId as they are regenerated on every render by Frontend. If they get included in the rendered HTML that gets cached by Fastly, it means we invalidate the cache entry more often than we need to.

I appreciate this is an obscure problem, but we are intending to remove elementId entirely to prevent this foot-gun.

If we don't have a use for elementId and it does not effect the schema validation then I think we could drop it entirely from this piece of work.

What do you think @JamieB-gu ?

Copy link
Contributor Author

@oliverabrahams oliverabrahams Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was only really because there was a missmatch between what FE was sending and we have in the type. We were copying the element response from FE for the nested elements in the ProductElement storybook

url: string;
label: string;
linkType: 'ProductButton';
Expand Down
Loading