Skip to content

Replace headerBlock.id with different value#13768

Open
hotinglok wants to merge 5 commits intolatestfrom
replace-react-ids-for-stream
Open

Replace headerBlock.id with different value#13768
hotinglok wants to merge 5 commits intolatestfrom
replace-react-ids-for-stream

Conversation

@hotinglok
Copy link
Contributor

@hotinglok hotinglok commented Mar 3, 2026

Resolves JIRA: N/A

Summary

There is currently ongoing work to add polling/automatically refreshing posts to Live pages. Part of this work is implementing the polling/client-side data fetching and it was found that the only difference between the post content from the Simorgh-BFF and the Stream module directly was the id property added to all blocks.

Most of the ids for the posts aren't being used, with only the headerBlock.id being used as a react key prop. Removing this would mean that we could either refetch the data directly from the Stream module (or at least require no transformation if we decide to use/create a new module for polling).

Code changes

  • Replaces key prop value with headerBlock.type-headerBlock.text (e.g. headline-some presumably unique text).
  • Removes id from related fixture data. This shouldn't affect any tests on Simorgh, though the actual change to remove this is a FABL change done in another PR.

Testing

  1. List the steps required to test this PR.

Useful Links

@hotinglok hotinglok marked this pull request as ready for review March 5, 2026 10:22
{headerBlocks.map(headerBlock => (
<PostHeadings key={headerBlock.id} headerBlock={headerBlock} />
<PostHeadings
key={`${headerBlock.type}-${headerBlock.model?.blocks?.[0]?.model?.blocks?.[0]?.model?.text}`}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change here, the linting rule prevents this from using an index from the map. This should be unique enough as these headers seem to only usually consist of headlines and subheadlines.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for highlighting the main change, LGTM!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants