-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
Size Change: -41 B (0%) Total Size: 1 MB
ℹ️ View Unchanged
|
.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 |
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.
"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; |
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.
should this not be return 0
(if there isn't a difference)?
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.
As discussed we're going to make so if there's no date it'll be considered to be year 2090
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.
if (a.end && b.end) { | ||
return a.end > b.end ? 1 : -1; | ||
} | ||
return 1; |
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.
same
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