WS-2610: Sport Data Polling (Front end changes)#14015
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds client-side polling support for the Sport Data “HeadToHeadV2” header on Live pages by introducing a dedicated polling hook + fetcher, and wiring it into the HeadToHeadV2 component and its consumers (tests/storybook updated accordingly).
Changes:
- Introduces
useSportDataPolling(15s interval) and amakeRequestfetcher for polling updated sport event data. - Updates Live page + Sport Data header to pass
initialSportData(instead ofdata) and to supply a live/polling flag. - Updates unit tests and Storybook stories/helpers to match the new prop/hook usage.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ws-nextjs-app/pages/[service]/live/[id]/LivePageLayout.tsx | Passes sport header initial data + live flag; adjusts local typing for sport data content. |
| ws-nextjs-app/pages/[service]/live/[id]/live.test.tsx | Updates mocks/fixtures to reflect new HeadToHeadV2 prop shape. |
| src/app/hooks/useSportDataPolling/index.ts | New polling hook that periodically requests updated sport data. |
| src/app/hooks/useSportDataPolling/index.test.ts | Unit tests for the new polling hook behavior. |
| src/app/hooks/useSportDataPolling/makeRequest/makeRequest.ts | New fetcher for the sports polling endpoint. |
| src/app/hooks/useSportDataPolling/makeRequest/makeRequest.test.ts | Unit tests for the new fetcher. |
| src/app/hooks/useSportDataPolling/fixture/fixtureSportData.js | Fixture for initial sport data used in hook tests. |
| src/app/hooks/useSportDataPolling/fixture/fixtureSportDataUpdate.js | Fixture for an updated sport data payload used in hook tests. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/head-to-head-v2.tsx | Wires polling hook into the HeadToHeadV2 component and adds new props. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/types.ts | Extends sport event type to include an event urn. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/tests/index.test.tsx | Mocks polling hook and updates prop usage for component tests. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/storybook/helpers/base-component.tsx | Updates Storybook helper usage to pass initialSportData. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/head-to-head-v2.stories.tsx | Updates stories to use initialSportData and satisfies the new urn requirement in args. |
Comments suppressed due to low confidence (1)
ws-nextjs-app/pages/[service]/live/[id]/LivePageLayout.tsx:72
sportDataEventContent.liveis declared as a required boolean, but the component logic treats it as nullable (isSportDataLive ?? isLive) and tests passlive: undefined. To keep the types aligned with actual/expected data,liveshould be optional (orboolean | null) inComponentProps.
sportDataEventContent?: {
urn: string;
live: boolean;
sportDataEvent: HeadToHeadV2Data;
title: string;
Contributor
Author
|
Heads up to reviewers - I've made an update based on the polling request data structure - (now it's live on test, I see had the structure slightly wrong) - https://github.com/bbc/simorgh/pull/14052/changes |
shayneahchoon
approved these changes
May 21, 2026
…xpected-data-format
…-format Ws 2610 extra adjust expected data format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves JIRA: https://bbc.atlassian.net/browse/WS-2610
Summary
Front end changes to support polling of sports data header
Code changes
Testing
http://localhost:7081/afrique/live/c7gk1vjglxn1t?renderer_env=test - polling is not live, so the initial data is displayed
Useful Links