Skip to content
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

Change ID in image galleries to avoid duplicates and fix exhibitions test #11446

Merged
merged 5 commits into from
Dec 17, 2024

Conversation

rcantin-w
Copy link
Contributor

@rcantin-w rcantin-w commented Dec 17, 2024

What does this change?

The way we split pages into various slice zones now (to allow for cookie tables or recommended stories), the id logic for image galleries now will result in duplicates (see failed pa11y test here). This logic simplifies it.

I also had to amend the exhibitions test that used to fail every time an exhibition was added (see fail here). We changed it in the past so we wouldn't have to add them in every time by slicing the first 6 results only, but we sorted them by ID, and in this case, the new exhibition's ID rated higher than one of the old ones. So I changed the logic to use the exhibition's end date instead.

How to test

Duplicate IDs: Run locally: http://localhost:3000/stories/the-birth-of-britain-s-national-health-service
Exhibition test: Do they pass here?

How can we measure success?

No more pa11y flags/duplicate IDs

Have we considered potential risks?

N/A

@rcantin-w rcantin-w self-assigned this Dec 17, 2024
@rcantin-w rcantin-w added epic: accessibility Performance, WCAG 2.0 AA as minimum, and everything else that increases the access to our content Bug 🐛 A change made to ensure a feature is maintaining the baseline KPIs. labels Dec 17, 2024
Copy link

github-actions bot commented Dec 17, 2024

Size Change: -41 B (0%)

Total Size: 1 MB

Filename Size Change
content/webapp/.next/static/chunks/3761.5a8f62ff6e7a1f25.js 0 B -6 kB (removed) 🏆
content/webapp/.next/static/chunks/webpack-85bae717339b031f.js 0 B -2.34 kB (removed) 🏆
content/webapp/.next/static/chunks/3761.8fd7def07323d72e.js 5.96 kB +5.96 kB (new file) 🆕
content/webapp/.next/static/chunks/webpack-18089cefd421f30c.js 2.33 kB +2.33 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
content/webapp/.next/static/chunks/00a8a139.e66d72e5d4e63786.js 58.7 kB
content/webapp/.next/static/chunks/1042.5e93690fb7f8387e.js 264 B
content/webapp/.next/static/chunks/1091.16812ffd5b0a4e6b.js 356 B
content/webapp/.next/static/chunks/1315.ecc44473f5526201.js 4.81 kB
content/webapp/.next/static/chunks/1895-507f9544a4d6b6f5.js 2.28 kB
content/webapp/.next/static/chunks/1922.8bec62a64b05a7ca.js 3.93 kB
content/webapp/.next/static/chunks/2075-d891038ae834fd5b.js 6.98 kB
content/webapp/.next/static/chunks/2158.0394ea6975f97a32.js 3.46 kB
content/webapp/.next/static/chunks/23-cf5a7458cbf01e28.js 2.67 kB
content/webapp/.next/static/chunks/2614-787bd6606a6c8a3d.js 7.2 kB
content/webapp/.next/static/chunks/2815-7fe70ae65244df23.js 3.59 kB
content/webapp/.next/static/chunks/286.e6c4fb42dbebd142.js 20.7 kB
content/webapp/.next/static/chunks/3279.d974bc9401d323e6.js 2.87 kB
content/webapp/.next/static/chunks/3310.3608c7a584df8db5.js 2.43 kB
content/webapp/.next/static/chunks/3407.8b6dc286e5611abd.js 264 B
content/webapp/.next/static/chunks/3514.768849ea20cecd5e.js 4.38 kB
content/webapp/.next/static/chunks/3562.1a682406fccbb2ec.js 371 B
content/webapp/.next/static/chunks/3661-448bee7d2db2b975.js 3.41 kB
content/webapp/.next/static/chunks/4125.067d1eec1c3eb4af.js 2.19 kB
content/webapp/.next/static/chunks/4137-5e52495ab949e477.js 3.67 kB
content/webapp/.next/static/chunks/4462-1870aa794a166104.js 3.06 kB
content/webapp/.next/static/chunks/4494-9ee08e6cd2d95cc0.js 4.68 kB
content/webapp/.next/static/chunks/4621-e5f1d46a28542299.js 4.59 kB
content/webapp/.next/static/chunks/4704-7fa9ebb41eea98d6.js 4.34 kB
content/webapp/.next/static/chunks/4812-30f16582dcbcb151.js 3 kB
content/webapp/.next/static/chunks/5041.a2ec4f918c672fc2.js 277 B
content/webapp/.next/static/chunks/5164-a648579346205c01.js 7.13 kB
content/webapp/.next/static/chunks/5226.f4c6d90f9be3f694.js 3.58 kB
content/webapp/.next/static/chunks/5239-d3cc68cce4a94ba9.js 3.2 kB
content/webapp/.next/static/chunks/5261.dd3c2f30153755bc.js 4.8 kB
content/webapp/.next/static/chunks/5314-33dd97d384f1d866.js 4.98 kB
content/webapp/.next/static/chunks/5563.bf65ed3e45ef0fa9.js 3.2 kB
content/webapp/.next/static/chunks/5858.600d3946b44d1606.js 4.53 kB
content/webapp/.next/static/chunks/5939-d1a715b0e5867fe7.js 2.92 kB
content/webapp/.next/static/chunks/6085-0449901545cd2111.js 3.69 kB
content/webapp/.next/static/chunks/6153-4f9cb324a7461ab0.js 4.43 kB
content/webapp/.next/static/chunks/6170.26830760c5f8bd3a.js 2.71 kB
content/webapp/.next/static/chunks/628-a14babf3fb2eb9d3.js 4.78 kB
content/webapp/.next/static/chunks/6287.ee607762046728e7.js 1.57 kB
content/webapp/.next/static/chunks/632-d69f29b17e01a4e4.js 3.13 kB
content/webapp/.next/static/chunks/6425-463de300c9e3974e.js 6.66 kB
content/webapp/.next/static/chunks/6577-545b35fa00e662d2.js 3.9 kB
content/webapp/.next/static/chunks/7107-7a0c6bd1411921e2.js 33.8 kB
content/webapp/.next/static/chunks/721-8422ecc6bd9759ae.js 7.55 kB
content/webapp/.next/static/chunks/7267-d9ca9d41f5d22bfd.js 4.45 kB
content/webapp/.next/static/chunks/7339.374c3283d903835f.js 1.64 kB
content/webapp/.next/static/chunks/7849.1818ba955cf06736.js 5.04 kB
content/webapp/.next/static/chunks/8091.53da6944a1e2f75a.js 3.12 kB
content/webapp/.next/static/chunks/8168-71b89264865ea44c.js 16.2 kB
content/webapp/.next/static/chunks/8194-9fe6d45e2c5b9530.js 2.96 kB
content/webapp/.next/static/chunks/8551-bb8b09e56dd31b24.js 5.27 kB
content/webapp/.next/static/chunks/8630.408947dd96fce642.js 1.67 kB
content/webapp/.next/static/chunks/8952.687023d7a5433c8b.js 2.83 kB
content/webapp/.next/static/chunks/8997-afbf62110474f301.js 11.4 kB
content/webapp/.next/static/chunks/9508-15b3624e4ddcda3e.js 3.48 kB
content/webapp/.next/static/chunks/9743.9681194ec6a5886b.js 3.31 kB
content/webapp/.next/static/chunks/9781-ea4cbf7a36ddc292.js 3.5 kB
content/webapp/.next/static/chunks/framework-978a6051e6d0c57a.js 44.9 kB
content/webapp/.next/static/chunks/main-16881ae36fd18535.js 36.8 kB
content/webapp/.next/static/chunks/pages/_app-6402247424ab3cdf.js 109 kB
content/webapp/.next/static/chunks/pages/_error-1e8090a460deeefd.js 331 B
content/webapp/.next/static/chunks/pages/[uid]-7527e33f6872045f.js 1.95 kB
content/webapp/.next/static/chunks/pages/404-8b7e615af6ded119.js 259 B
content/webapp/.next/static/chunks/pages/500-4bf99f3036ceb64d.js 258 B
content/webapp/.next/static/chunks/pages/about-us-361578a2db8cb6b3.js 1.95 kB
content/webapp/.next/static/chunks/pages/about-us/[uid]-139f0cecc5512a62.js 1.96 kB
content/webapp/.next/static/chunks/pages/about-us/cookie-policy-2e84e46a05237472.js 6 kB
content/webapp/.next/static/chunks/pages/books-775381283e1df1f1.js 2.02 kB
content/webapp/.next/static/chunks/pages/books/[bookId]-5a7840b3936137b3.js 4.1 kB
content/webapp/.next/static/chunks/pages/collections-6dca1966a2d6b2ea.js 2.36 kB
content/webapp/.next/static/chunks/pages/collections/[uid]-f6080fe0da460c3c.js 2.3 kB
content/webapp/.next/static/chunks/pages/concepts/[conceptId]-102bb0cf9a2af6a4.js 3.77 kB
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-cbcfac6a9b6f1168.js 2.93 kB
content/webapp/.next/static/chunks/pages/events-8ef663547105417d.js 2.14 kB
content/webapp/.next/static/chunks/pages/events/[eventId]-4bf080531a37e15d.js 8.88 kB
content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-1906248e2d6a69eb.js 302 B
content/webapp/.next/static/chunks/pages/exhibitions-42f40ddbef505fd7.js 2.39 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-8bbf66c15c7217b0.js 3.98 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-c4005ca8f1ca5ea5.js 303 B
content/webapp/.next/static/chunks/pages/get-involved-a62c0c25f9b18dcc.js 1.96 kB
content/webapp/.next/static/chunks/pages/get-involved/[uid]-55a3a631ddad1f9b.js 1.96 kB
content/webapp/.next/static/chunks/pages/guides/[guideId]-11be28164874e33f.js 2.27 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions-14628bd8dae14651.js 2.65 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-0eaf6c38d3c03ff8.js 2.77 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-bf620e51833fe788.js 7.21 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-eaaeacc0c79312f2.js 3.71 kB
content/webapp/.next/static/chunks/pages/index-4de5e67cb03ffc80.js 3.46 kB
content/webapp/.next/static/chunks/pages/newsletter-8d1c5a82c17792a6.js 2.34 kB
content/webapp/.next/static/chunks/pages/pages/[pageId]-eeb3eeb2d57d2e2a.js 1.92 kB
content/webapp/.next/static/chunks/pages/projects/[projectId]-d40f5e00fc7e04f6.js 2.24 kB
content/webapp/.next/static/chunks/pages/search-2102c2928dd0788a.js 5.11 kB
content/webapp/.next/static/chunks/pages/search/events-8c5ae29c842eca33.js 2.03 kB
content/webapp/.next/static/chunks/pages/search/images-e4f5e6305482bee9.js 1.58 kB
content/webapp/.next/static/chunks/pages/search/stories-5708c5228a094a88.js 3.1 kB
content/webapp/.next/static/chunks/pages/search/works-f71aef1a1bd70c50.js 2.95 kB
content/webapp/.next/static/chunks/pages/seasons/[seasonId]-4b2b86222b83ff8f.js 3.87 kB
content/webapp/.next/static/chunks/pages/series/[seriesId]-05b65d2a8cb6eafe.js 5.09 kB
content/webapp/.next/static/chunks/pages/slice-simulator-c8446f30506e0da3.js 976 B
content/webapp/.next/static/chunks/pages/stories-c843b6da3e2beb3f.js 1.73 kB
content/webapp/.next/static/chunks/pages/stories/[articleId]-cf71d1a621ea1010.js 6.67 kB
content/webapp/.next/static/chunks/pages/visit-us-a61e4f2b33a771dc.js 2.28 kB
content/webapp/.next/static/chunks/pages/visit-us/[uid]-cb100b2240081adf.js 1.96 kB
content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-065e8bd4c638bcf5.js 236 B
content/webapp/.next/static/chunks/pages/whats-on-c9310d4e512cbd3f.js 212 B
content/webapp/.next/static/chunks/pages/whats-on/[period]-d0058c8db76a5793.js 283 B
content/webapp/.next/static/chunks/pages/works/[workId]-dd69cfcd0ba3fa83.js 20.5 kB
content/webapp/.next/static/chunks/pages/works/[workId]/download-d7d0f47c9c009d0c.js 2.74 kB
content/webapp/.next/static/chunks/pages/works/[workId]/images-dcd5e2de51ef7303.js 697 B
content/webapp/.next/static/chunks/pages/works/[workId]/items-0758a2dc89e1beb7.js 2.35 kB
content/webapp/.next/static/chunks/polyfills-78c92fac7aa8fdd8.js 31.1 kB
identity/webapp/.next/static/chunks/286.30e19e68d137a7fe.js 20.7 kB
identity/webapp/.next/static/chunks/442-16a4fdfe63454534.js 9.09 kB
identity/webapp/.next/static/chunks/50.5b4e17f82c3c9a70.js 940 B
identity/webapp/.next/static/chunks/528.b0c7a0dca90cafcc.js 2.71 kB
identity/webapp/.next/static/chunks/644-f0cfb6459ad9993f.js 16.2 kB
identity/webapp/.next/static/chunks/framework-e82a91356956e6c8.js 44.8 kB
identity/webapp/.next/static/chunks/main-9fde6a01d715973d.js 38.9 kB
identity/webapp/.next/static/chunks/pages/_app-333230635004e99d.js 105 kB
identity/webapp/.next/static/chunks/pages/_error-f92497dca926c5b1.js 1.45 kB
identity/webapp/.next/static/chunks/pages/delete-requested-aba6285540faf31a.js 3.23 kB
identity/webapp/.next/static/chunks/pages/error-5c81263d2bc0f671.js 1.7 kB
identity/webapp/.next/static/chunks/pages/index-e4ea043acc34600a.js 12 kB
identity/webapp/.next/static/chunks/pages/registration-826df2289f963cc4.js 4.13 kB
identity/webapp/.next/static/chunks/pages/success-bd9f4e9b2f8aef7a.js 3.3 kB
identity/webapp/.next/static/chunks/pages/validated-9d66f88ab86c3ab6.js 3.38 kB
identity/webapp/.next/static/chunks/polyfills-78c92fac7aa8fdd8.js 31.1 kB
identity/webapp/.next/static/chunks/webpack-dd4d49330c88bc7f.js 1.81 kB

compressed-size-action

@rcantin-w rcantin-w changed the title Change ID in image galleries to avoid duplicates Change ID in image galleries to avoid duplicates and fix exhibitions test Dec 17, 2024
@rcantin-w rcantin-w marked this pull request as ready for review December 17, 2024 13:20
@rcantin-w rcantin-w requested a review from a team as a code owner December 17, 2024 13:20
.sort((a, b) => {
// Makes TS happy but this condition should never not work
// we always have an end date, even for permanent exhibitions
// e.g. Being Human ends in 2090
Copy link
Contributor

Choose a reason for hiding this comment

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

"Being Human ends in 2090". I'll be happy if I've made it that far

if (a.end && b.end) {
return a.end > b.end ? 1 : -1;
}
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this not be return 0 (if there isn't a difference)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed we're going to make so if there's no date it'll be considered to be year 2090

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if (a.end && b.end) {
return a.end > b.end ? 1 : -1;
}
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@rcantin-w rcantin-w merged commit c092100 into main Dec 17, 2024
8 checks passed
@rcantin-w rcantin-w deleted the duplicate-ids branch December 17, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 A change made to ensure a feature is maintaining the baseline KPIs. epic: accessibility Performance, WCAG 2.0 AA as minimum, and everything else that increases the access to our content
Projects
Development

Successfully merging this pull request may close these issues.

2 participants