-
Notifications
You must be signed in to change notification settings - Fork 30
Add element Id to Link Element model #14771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mob/product-element
Are you sure you want to change the base?
Add element Id to Link Element model #14771
Conversation
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
|
|
||
| export interface LinkBlockElement { | ||
| _type: 'model.dotcomrendering.pageElements.LinkBlockElement'; | ||
| elementId: string; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
This PR adds the
elementIdproperty inLinkBlockElement. TheelementIdis already passed from Frontend but wasn’t previously included in the type definitions.Changes
elementIdto the LinkBlockElement type incontent.ts.block-schema.json,feArticle.json) to includeelementIdas a required property.elementIdfor consistency.