Skip to content

Conversation

@oliverabrahams
Copy link
Contributor

@oliverabrahams oliverabrahams commented Oct 29, 2025

This PR adds the elementId property in LinkBlockElement. The elementId is already passed from Frontend but wasn’t previously included in the type definitions.

Changes

  • Added elementId to the LinkBlockElement type in content.ts.
  • Updated related schema files (block-schema.json, feArticle.json) to include elementId as a required property.
  • Updated Storybook and product sample data to include elementId for consistency.

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

@oliverabrahams oliverabrahams marked this pull request as ready for review October 30, 2025 09:00
@github-actions
Copy link

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@charleycampbell charleycampbell changed the title Add element Id to Link Element model. Add element Id to Link Element model Oct 30, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants