Skip to content

Commit 5c1d2a5

Browse files
Football tables - only hydrate the competition select (#13701)
* move island around just the select instead of the whole page
1 parent 23a8130 commit 5c1d2a5

File tree

4 files changed

+36
-47
lines changed

4 files changed

+36
-47
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { Region } from '../footballMatches';
2+
import { FootballCompetitionSelect } from './FootballCompetitionSelect';
3+
4+
const goToCompetitionSpecificPage =
5+
(guardianBaseUrl: string) => (path: string) => {
6+
const url = `${guardianBaseUrl}${path}`;
7+
window.location.assign(url);
8+
};
9+
10+
type Props = {
11+
regions: Region[];
12+
pageId: string;
13+
guardianBaseUrl: string;
14+
};
15+
16+
export const FootballTablesCompetitionSelect = ({
17+
regions,
18+
pageId,
19+
guardianBaseUrl,
20+
}: Props) => (
21+
<FootballCompetitionSelect
22+
regions={regions}
23+
pageId={pageId}
24+
onChange={goToCompetitionSpecificPage(guardianBaseUrl)}
25+
kind="Tables"
26+
/>
27+
);

dotcom-rendering/src/components/FootballTablesPage.stories.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from '@storybook/react/*';
2-
import { fn } from '@storybook/test';
32
import { regions } from '../../fixtures/manual/footballData';
43
import { FootballTableList as TableListDefault } from './FootballTableList.stories';
54
import { FootballTablesPage as FootballTablesPageComponent } from './FootballTablesPage';
@@ -16,7 +15,6 @@ type Story = StoryObj<typeof meta>;
1615
export const FootballTablesPage = {
1716
args: {
1817
regions,
19-
goToCompetitionSpecificPage: fn(),
2018
pageId: 'football/tables',
2119
competitions: TableListDefault.args.competitions,
2220
renderAds: true,

dotcom-rendering/src/components/FootballTablesPage.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import type { FootballTableCompetition } from '../footballTables';
1010
import { grid } from '../grid';
1111
import { palette } from '../palette';
1212
import { AdSlot } from './AdSlot.web';
13-
import { FootballCompetitionSelect } from './FootballCompetitionSelect';
1413
import { FootballTableList } from './FootballTableList';
14+
import { FootballTablesCompetitionSelect } from './FootballTablesCompetitionSelect.importable';
15+
import { Island } from './Island';
1516

1617
type Props = {
1718
regions: Region[];
1819
pageId: string;
19-
goToCompetitionSpecificPage: (tag: string) => void;
2020
competitions: FootballTableCompetition[];
2121
renderAds: boolean;
2222
guardianBaseUrl: string;
@@ -25,7 +25,6 @@ type Props = {
2525
export const FootballTablesPage = ({
2626
regions,
2727
pageId,
28-
goToCompetitionSpecificPage,
2928
competitions,
3029
renderAds,
3130
guardianBaseUrl,
@@ -75,12 +74,13 @@ export const FootballTablesPage = ({
7574
grid-row: 2;
7675
`}
7776
>
78-
<FootballCompetitionSelect
79-
regions={regions}
80-
kind="Tables"
81-
pageId={pageId}
82-
onChange={goToCompetitionSpecificPage}
83-
/>
77+
<Island priority="feature" defer={{ until: 'visible' }}>
78+
<FootballTablesCompetitionSelect
79+
regions={regions}
80+
pageId={pageId}
81+
guardianBaseUrl={guardianBaseUrl}
82+
/>
83+
</Island>
8484
</div>
8585
<div
8686
css={css`

dotcom-rendering/src/components/FootballTablesPageWrapper.importable.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)