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

Update link resolver #11190

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Update link resolver #11190

wants to merge 8 commits into from

Conversation

gestchild
Copy link
Contributor

What does this change?

For #11074

  • Updates the link resolver function to use the uid instead of id
  • Replaces hardcoded urls with the linkResolver function where is wasn't being used
  • Tries to fetch pages by uid first rather than id, as these are now more likely to be successful
  • Updates relevant tests

How to test

  • Click on links on the website site (breadcrumbs, cards etc.). The links should contain the human readable uid instead of the id.
  • Preview pages from Prismic, the urls should contain the human readable uid instead of the id.

How can we measure success?

Human readable uid is present in the url of a page rather than the id of the document

Have we considered potential risks?

  • I may have missed some hardcoded urls (If so they will still work until we stop fetching pages by id).

@gestchild gestchild requested a review from a team as a code owner September 18, 2024 11:16
Copy link

Size Change: +95 B (+0.01%)

Total Size: 983 kB

Filename Size Change
content/webapp/.next/static/chunks/1747-d24552b43bf2fb4c.js 0 B -7.01 kB (removed) 🏆
content/webapp/.next/static/chunks/2630-b919a065dd992def.js 0 B -4.47 kB (removed) 🏆
content/webapp/.next/static/chunks/3250-a70845a1e39017bc.js 0 B -3.45 kB (removed) 🏆
content/webapp/.next/static/chunks/4621-ab4aca14b803d31d.js 0 B -5.11 kB (removed) 🏆
content/webapp/.next/static/chunks/6614-8911068edd0aaa18.js 0 B -5.07 kB (removed) 🏆
content/webapp/.next/static/chunks/6862-91c007809c5d7021.js 0 B -4.42 kB (removed) 🏆
content/webapp/.next/static/chunks/722-21d9ce4aab394c3a.js 0 B -3.24 kB (removed) 🏆
content/webapp/.next/static/chunks/8476-3acb48904d7868c0.js 0 B -3.95 kB (removed) 🏆
content/webapp/.next/static/chunks/9519-55b48b48b0649e79.js 0 B -7.59 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/_app-35a0e0b27f242dc2.js 0 B -111 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/articles/[articleId]-cbb18e9b777ea899.js 0 B -6.77 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/books/[bookId]-6aba37351c45d4b7.js 0 B -4.18 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/collections-6fb4e5d8ce5e5a77.js 0 B -2.05 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-74de1df62057047d.js 0 B -3.28 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/events/[eventId]-6a918ecf1d71e2a1.js 0 B -9.11 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-c6c90670cf86cbe3.js 0 B -4.36 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/[guideId]-83338107c2462b12.js 0 B -2.25 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/index-1a5e2240a5f06e4c.js 0 B -3.67 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/pages/[pageId]-615e05c6c54d86fd.js 0 B -1.93 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/projects/[projectId]-d3debff0089440d1.js 0 B -2.27 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/search-83584cdc5f625b49.js 0 B -5.33 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/search/stories-c81e9fefa66eb837.js 0 B -3.24 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/series/[seriesId]-b15b1f46be6b3c6c.js 0 B -5.57 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/visit-us-49c72a530f0af909.js 0 B -2.44 kB (removed) 🏆
content/webapp/.next/static/chunks/webpack-11615e70983867f7.js 0 B -2.33 kB (removed) 🏆
identity/webapp/.next/static/chunks/pages/_app-75cb7f73db8b12b9.js 0 B -104 kB (removed) 🏆
content/webapp/.next/static/chunks/1747-840aa0569a4422aa.js 7 kB +7 kB (new file) 🆕
content/webapp/.next/static/chunks/2630-62040dd16d2ea9bb.js 4.48 kB +4.48 kB (new file) 🆕
content/webapp/.next/static/chunks/3250-77ce953aee0fdf05.js 3.45 kB +3.45 kB (new file) 🆕
content/webapp/.next/static/chunks/4621-33a6614514971596.js 5.11 kB +5.11 kB (new file) 🆕
content/webapp/.next/static/chunks/6614-8ef55d3ba64bb34e.js 5.07 kB +5.07 kB (new file) 🆕
content/webapp/.next/static/chunks/6862-e600f76ce9af6895.js 4.42 kB +4.42 kB (new file) 🆕
content/webapp/.next/static/chunks/722-2ea510a68b985c2d.js 3.22 kB +3.22 kB (new file) 🆕
content/webapp/.next/static/chunks/8476-eaa9e8a414c7fc26.js 3.96 kB +3.96 kB (new file) 🆕
content/webapp/.next/static/chunks/9519-bfdc3e94d6a91c45.js 7.59 kB +7.59 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/_app-6a29660c5f2953d1.js 111 kB +111 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/articles/[articleId]-d72152f5c96a9c74.js 6.78 kB +6.78 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/books/[bookId]-e6661a3f6cd6e952.js 4.2 kB +4.2 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/collections-6f751421f507eff1.js 2.05 kB +2.05 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-7ab257427ff13200.js 3.28 kB +3.28 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/events/[eventId]-3a7a1a0f8cc8f3b1.js 9.12 kB +9.12 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-aaaaec220a97a770.js 4.37 kB +4.37 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/[guideId]-20ea73204938e551.js 2.25 kB +2.25 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/index-838df7ca2203ba3c.js 3.67 kB +3.67 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/pages/[pageId]-a38b8fbb0e2c7adc.js 1.93 kB +1.93 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/projects/[projectId]-24dc4ed04966f361.js 2.27 kB +2.27 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/search-e90b246a79e8390c.js 5.34 kB +5.34 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/search/stories-4917b8255e1060e3.js 3.24 kB +3.24 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/series/[seriesId]-5a3ae8b3669628e8.js 5.58 kB +5.58 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/visit-us-d6436662dd928397.js 2.44 kB +2.44 kB (new file) 🆕
content/webapp/.next/static/chunks/webpack-7e2b727b99d54f7d.js 2.33 kB +2.33 kB (new file) 🆕
identity/webapp/.next/static/chunks/pages/_app-ed0e901d1fb4e040.js 104 kB +104 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
content/webapp/.next/static/chunks/00a8a139.976ae5fd9989bf10.js 59 kB
content/webapp/.next/static/chunks/1002-1e44267bf0785811.js 4.31 kB
content/webapp/.next/static/chunks/132.6d64b36fa83a32ac.js 4.56 kB
content/webapp/.next/static/chunks/1349.7701e5adcb1fd447.js 3.19 kB
content/webapp/.next/static/chunks/1624.36ee3a10cb481879.js 270 B
content/webapp/.next/static/chunks/2223.a313419f598b2799.js 1.8 kB
content/webapp/.next/static/chunks/2224.c3d36692d71659d1.js 409 B
content/webapp/.next/static/chunks/2545.442b1bd598106289.js 3.49 kB
content/webapp/.next/static/chunks/2568.a95d7548282f8284.js 2.82 kB
content/webapp/.next/static/chunks/267-c285674ca727ab21.js 3.7 kB
content/webapp/.next/static/chunks/286.b066630328a98bd8.js 20.8 kB
content/webapp/.next/static/chunks/3.45d62458e087d14b.js 2.78 kB
content/webapp/.next/static/chunks/3199.3edd37455bfa47b9.js 2.58 kB
content/webapp/.next/static/chunks/3419.96384eef9a77e6cd.js 419 B
content/webapp/.next/static/chunks/3420-ae78dad3086579db.js 3.86 kB
content/webapp/.next/static/chunks/3627.68684dea05242cf8.js 1.77 kB
content/webapp/.next/static/chunks/382-550cbb47a80b4c5d.js 3.07 kB
content/webapp/.next/static/chunks/4468.77ca11ce8e014f65.js 6.43 kB
content/webapp/.next/static/chunks/4825-4df3e43759acfe8c.js 7.76 kB
content/webapp/.next/static/chunks/4962-9b96a4c700b61e4b.js 12.3 kB
content/webapp/.next/static/chunks/5006-cff42aa46afe5dd2.js 7.56 kB
content/webapp/.next/static/chunks/5048.586f8d7ac12988a9.js 4.86 kB
content/webapp/.next/static/chunks/5068.5fbb37baec682e76.js 3.3 kB
content/webapp/.next/static/chunks/5292-15804cb0ddb16755.js 2.83 kB
content/webapp/.next/static/chunks/5389.6e04a2b26697b2b7.js 1.7 kB
content/webapp/.next/static/chunks/5637-f2644f4041547799.js 20.5 kB
content/webapp/.next/static/chunks/5768-e2032a20d09a518d.js 3.18 kB
content/webapp/.next/static/chunks/6207.210a73c1d1dacf3e.js 268 B
content/webapp/.next/static/chunks/6318.9c41f15db970dd0b.js 2.29 kB
content/webapp/.next/static/chunks/6501.28ce8d42744c59bf.js 281 B
content/webapp/.next/static/chunks/6577-effbaab7dae5448b.js 3.52 kB
content/webapp/.next/static/chunks/6879.2a7add2b9ecb2a54.js 2.6 kB
content/webapp/.next/static/chunks/7044-965e15123db8e3d8.js 5.43 kB
content/webapp/.next/static/chunks/7107-a5393520646f32da.js 26.8 kB
content/webapp/.next/static/chunks/7414-03438ef5466cad65.js 6 kB
content/webapp/.next/static/chunks/7440.56f09d5adc0ebea4.js 4.78 kB
content/webapp/.next/static/chunks/7888.b267f37f7137301f.js 5.31 kB
content/webapp/.next/static/chunks/8189-d849c040d0a041f1.js 3.45 kB
content/webapp/.next/static/chunks/8348.d518b21f25b34712.js 3.28 kB
content/webapp/.next/static/chunks/9042-448e49feb8581ddb.js 5.13 kB
content/webapp/.next/static/chunks/9049-2e8aa422dab80069.js 3.71 kB
content/webapp/.next/static/chunks/908.32b614a3a5f080ff.js 3.89 kB
content/webapp/.next/static/chunks/9590.16b233936adefde2.js 2.65 kB
content/webapp/.next/static/chunks/9680-dff0d515191669c6.js 3.09 kB
content/webapp/.next/static/chunks/9778-b887eaabecd73dfc.js 3.06 kB
content/webapp/.next/static/chunks/9950.3bfb13b74b3d8830.js 3.17 kB
content/webapp/.next/static/chunks/framework-cd51c6317946e9aa.js 45.2 kB
content/webapp/.next/static/chunks/main-978dba4ddde48128.js 30.7 kB
content/webapp/.next/static/chunks/pages/_error-4ae94352bfd58ed4.js 335 B
content/webapp/.next/static/chunks/pages/404-9b6af81752f83cf9.js 263 B
content/webapp/.next/static/chunks/pages/500-7bf98e2f0d70a0db.js 262 B
content/webapp/.next/static/chunks/pages/articles-c2e91bce5f591523.js 2.34 kB
content/webapp/.next/static/chunks/pages/books-f674e683b16ade69.js 2.34 kB
content/webapp/.next/static/chunks/pages/concepts/[conceptId]-1bcb81ba1f847ac5.js 3.84 kB
content/webapp/.next/static/chunks/pages/cookie-policy-8242f7234b49eeaa.js 6.32 kB
content/webapp/.next/static/chunks/pages/events-9577cf6c618b29e5.js 2.46 kB
content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-a983536c3e5e28a8.js 302 B
content/webapp/.next/static/chunks/pages/exhibitions-c3e6b2bff56e2ee0.js 2.69 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-d1aeb46e8e916d28.js 303 B
content/webapp/.next/static/chunks/pages/guides/exhibitions-c9b8bb94a51d646e.js 2.98 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-7a78c703ae06e3ba.js 3.29 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-3434597e518617af.js 8.07 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-fb727f71fccfbe49.js 3.59 kB
content/webapp/.next/static/chunks/pages/newsletter-27355b9178dfced3.js 2.4 kB
content/webapp/.next/static/chunks/pages/search/events-6b646d3a8bac6fd1.js 2.05 kB
content/webapp/.next/static/chunks/pages/search/images-cf2960032a2ba454.js 1.6 kB
content/webapp/.next/static/chunks/pages/search/works-0e3730e8f6aa3e3d.js 4.39 kB
content/webapp/.next/static/chunks/pages/seasons/[seasonId]-921e76a64153f6f2.js 3.93 kB
content/webapp/.next/static/chunks/pages/slice-simulator-103f00e4f239888d.js 8.48 kB
content/webapp/.next/static/chunks/pages/stories-6bf7a5a136938b1e.js 1.77 kB
content/webapp/.next/static/chunks/pages/stories/[contentType]-84a8c198dac784e6.js 2.38 kB
content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-0e090de4ea368053.js 237 B
content/webapp/.next/static/chunks/pages/whats-on-d3f1b7279bb5142e.js 213 B
content/webapp/.next/static/chunks/pages/whats-on/[period]-9d135cd2564e60da.js 285 B
content/webapp/.next/static/chunks/pages/works/[workId]-b442a0af9a1cdfbe.js 21.9 kB
content/webapp/.next/static/chunks/pages/works/[workId]/download-382f2362014e3031.js 3.05 kB
content/webapp/.next/static/chunks/pages/works/[workId]/images-e2822ce848b013c2.js 678 B
content/webapp/.next/static/chunks/pages/works/[workId]/items-012550f624ac99f2.js 216 B
content/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
identity/webapp/.next/static/chunks/286.b94e91b70e38ea49.js 20.7 kB
identity/webapp/.next/static/chunks/374.94537fd117195c86.js 2.47 kB
identity/webapp/.next/static/chunks/432.fa29da5acdb8e0b1.js 744 B
identity/webapp/.next/static/chunks/442-f1af16c3993c320a.js 8.96 kB
identity/webapp/.next/static/chunks/644-9f6f94597a590125.js 15.1 kB
identity/webapp/.next/static/chunks/framework-b330de622121c9cc.js 45.2 kB
identity/webapp/.next/static/chunks/main-d973a3979032d64a.js 32.2 kB
identity/webapp/.next/static/chunks/pages/_error-8e82953fa241027d.js 1.42 kB
identity/webapp/.next/static/chunks/pages/delete-requested-81c04cd539b95921.js 3.22 kB
identity/webapp/.next/static/chunks/pages/error-5042fa7f9e639d9d.js 1.7 kB
identity/webapp/.next/static/chunks/pages/index-69804913b1c12ca3.js 12 kB
identity/webapp/.next/static/chunks/pages/registration-08bfce27660433fe.js 4.1 kB
identity/webapp/.next/static/chunks/pages/success-2c7006ac28a47b5c.js 3.29 kB
identity/webapp/.next/static/chunks/pages/validated-285d6a66d9a05d92.js 3.36 kB
identity/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
identity/webapp/.next/static/chunks/webpack-d9d97d637ba6ec7a.js 1.82 kB

compressed-size-action

if (
type === 'exhibition-guides' ||
type === 'exhibition-texts' ||
type === 'exhibition-highlight-tours'
)
return `/guides/exhibitions/${id}`;
return `/guides/exhibitions/${uid}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kind of unrelated to this ticket, but am I correct in thinking this could potentially link to a 404 since it only uses one of the guides' id?

@@ -22,8 +22,10 @@ export const getServerSideProps = async context => {

const visualStoryDocument = visualStoriesQuery.results.find(result => {
return (
// TODO once redirects are in place we should only compare with uid
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we link to a ticket (is there one)?

@@ -22,8 +22,10 @@ export const getServerSideProps = async context => {

const visualStoryDocument = visualStoriesQuery.results.find(result => {
return (
// TODO once redirects are in place we should only compare with uid
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

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.

2 participants