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

Fix Page preview link #11353

Merged
merged 4 commits into from
Oct 30, 2024
Merged

Fix Page preview link #11353

merged 4 commits into from
Oct 30, 2024

Conversation

rcantin-w
Copy link
Contributor

@rcantin-w rcantin-w commented Oct 30, 2024

What does this change?

#11346
Moves siteSection types and type guard into model folder.
Amend linkResolver to account for untransformed data (which was causing the link to be wrong).

I don't fully grasp why I couldn't import isSiteSection from PageLayout (build was breaking). I know it had to do with the code not being able to compile properly. I moved it into model as anyway it seems to be where we keep types.

How to test

Run locally and preview a Prismic Page locally, see if the URL makes sense and you can actually preview it.

How can we measure success?

No more broken previewing of Pages!

Have we considered potential risks?

N/A


import { isContentType } from './content-types';

type Props = {
uid?: string;
type: string;
siteSection?: SiteSection;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should've always been there as it's only present in transformed documents.

Copy link

github-actions bot commented Oct 30, 2024

Size Change: +220 B (+0.02%)

Total Size: 982 kB

Filename Size Change
content/webapp/.next/static/chunks/132.1d7e9ae9baf2bf3e.js 0 B -4.82 kB (removed) 🏆
content/webapp/.next/static/chunks/1747-fefcb42dbbfafe34.js 0 B -6.96 kB (removed) 🏆
content/webapp/.next/static/chunks/3471-3190db4014728fdb.js 0 B -2.76 kB (removed) 🏆
content/webapp/.next/static/chunks/4537-29080707bc0242bb.js 0 B -4.22 kB (removed) 🏆
content/webapp/.next/static/chunks/5286-bee6f4dcdeeae555.js 0 B -3.27 kB (removed) 🏆
content/webapp/.next/static/chunks/5292-b399898dfbbd0ba7.js 0 B -2.83 kB (removed) 🏆
content/webapp/.next/static/chunks/6862-ab9a369e10d24008.js 0 B -4.46 kB (removed) 🏆
content/webapp/.next/static/chunks/722-2ee52edde987a147.js 0 B -3.25 kB (removed) 🏆
content/webapp/.next/static/chunks/7603-ae8849f32a8640b6.js 0 B -3.26 kB (removed) 🏆
content/webapp/.next/static/chunks/7888.a02595574e302988.js 0 B -5.3 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/_app-57bca232f0f33952.js 0 B -110 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/[uid]-e305752b7019cf9b.js 0 B -1.97 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/about-us-0d82c6f665195de1.js 0 B -1.97 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/about-us/[uid]-4517049edeb7bb2c.js 0 B -1.97 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/books-20edbf7e2e9dfc4d.js 0 B -2.98 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/books/[bookId]-077d421bd1e84d05.js 0 B -4.2 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/collections-5d17667caec39f6a.js 0 B -2.38 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/collections/[uid]-0115fc8d5a43ade4.js 0 B -1.97 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-10f4eff99691fdee.js 0 B -3.29 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/events-783010f5e767e147.js 0 B -3.09 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/events/[eventId]-8c9f3d3d3088961f.js 0 B -9.12 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/exhibitions-d202846410e7833b.js 0 B -3.33 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-b8d995e61cd21d74.js 0 B -4.03 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/get-involved-c8c8a19055c2f543.js 0 B -1.97 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/get-involved/[uid]-3d15efb771f0219a.js 0 B -1.98 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/[guideId]-4cad5be175328768.js 0 B -2.28 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/exhibitions-c6009d0dde8bef6b.js 0 B -3.56 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-a0c813725d8c9372.js 0 B -3.51 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-e20ea2f1870b9a00.js 0 B -7.31 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-0a15eccf1f452b59.js 0 B -3.91 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/pages/[pageId]-5b0501b00935e191.js 0 B -1.93 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/projects/[projectId]-6a3ac57c911456fa.js 0 B -2.26 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/search-8637bfa593af83bb.js 0 B -5.34 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/search/stories-4e28bc872fef8407.js 0 B -3.27 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/series/[seriesId]-58f8f6c9d908435d.js 0 B -5.55 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/stories-73aba6d990e3f2e9.js 0 B -3.64 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/stories/[articleId]-b34b26e805bb366a.js 0 B -7.13 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/visit-us-1289d8710ce2b47b.js 0 B -2.29 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/visit-us/[uid]-afff369e510dfeab.js 0 B -1.98 kB (removed) 🏆
content/webapp/.next/static/chunks/webpack-19aaff0b2ff3f8f1.js 0 B -2.33 kB (removed) 🏆
identity/webapp/.next/static/chunks/pages/_app-0bce15282db7ba3b.js 0 B -104 kB (removed) 🏆
content/webapp/.next/static/chunks/132.a3e6dccd1c7be577.js 4.82 kB +4.82 kB (new file) 🆕
content/webapp/.next/static/chunks/1747-9b37837e7a655501.js 6.96 kB +6.96 kB (new file) 🆕
content/webapp/.next/static/chunks/3471-2d163d9eb60afaf9.js 2.77 kB +2.77 kB (new file) 🆕
content/webapp/.next/static/chunks/4537-aed562e9224ed8f2.js 4.22 kB +4.22 kB (new file) 🆕
content/webapp/.next/static/chunks/5286-de436fa2a0f41643.js 3.27 kB +3.27 kB (new file) 🆕
content/webapp/.next/static/chunks/5292-c9184bd963da2e99.js 2.83 kB +2.83 kB (new file) 🆕
content/webapp/.next/static/chunks/6862-6cb73d49b8e04c30.js 4.47 kB +4.47 kB (new file) 🆕
content/webapp/.next/static/chunks/722-5fab1f60706c5d9d.js 3.25 kB +3.25 kB (new file) 🆕
content/webapp/.next/static/chunks/7603-2c1fce9be705b72d.js 3.26 kB +3.26 kB (new file) 🆕
content/webapp/.next/static/chunks/7888.8e9fcf84cd7c25ed.js 5.29 kB +5.29 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/_app-cd8ad9b30ff4f4d0.js 111 kB +111 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/[uid]-daa54634d1052e14.js 1.97 kB +1.97 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/about-us-ab121ac90c3fe1d4.js 1.97 kB +1.97 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/about-us/[uid]-509b7d82c9bdbd34.js 1.97 kB +1.97 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/books-5337fdd5f8527fa6.js 2.99 kB +2.99 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/books/[bookId]-416cfafb224551c8.js 4.21 kB +4.21 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/collections-33584499bc251354.js 2.38 kB +2.38 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/collections/[uid]-e35ec1d58435aa91.js 1.97 kB +1.97 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-f068b8cf78012474.js 3.29 kB +3.29 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/events-5f00a9cf8b5f39e9.js 3.1 kB +3.1 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/events/[eventId]-187554644327b2e3.js 9.12 kB +9.12 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/exhibitions-8540408493be5658.js 3.34 kB +3.34 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-cb28b1c18571b7a5.js 4.03 kB +4.03 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/get-involved-3713e5ba8958a38f.js 1.97 kB +1.97 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/get-involved/[uid]-d15a7b8676a28065.js 1.98 kB +1.98 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/[guideId]-05cc9a1534886857.js 2.28 kB +2.28 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/exhibitions-c1c86bdb4c433091.js 3.57 kB +3.57 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-6b6cb70b570043cc.js 3.53 kB +3.53 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-5f83709f575851fa.js 7.31 kB +7.31 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-1e99a121a4520af9.js 3.9 kB +3.9 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/pages/[pageId]-c564409324b8e843.js 1.94 kB +1.94 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/projects/[projectId]-b954900674b25a9b.js 2.26 kB +2.26 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/search-dd2b452f635fb0c0.js 5.34 kB +5.34 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/search/stories-6845c80b54516d6a.js 3.26 kB +3.26 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/series/[seriesId]-8fa01d36e6429120.js 5.55 kB +5.55 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/stories-f2274452dd7b26e3.js 3.64 kB +3.64 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/stories/[articleId]-12410f9dd859cfef.js 7.13 kB +7.13 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/visit-us-f4d0822b45f64bf6.js 2.29 kB +2.29 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/visit-us/[uid]-4106d1c9bb5d230b.js 1.98 kB +1.98 kB (new file) 🆕
content/webapp/.next/static/chunks/webpack-8a9b58c84d2975e0.js 2.33 kB +2.33 kB (new file) 🆕
identity/webapp/.next/static/chunks/pages/_app-22409d725935c787.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/1349.d2a91366cd45a4ca.js 1.13 kB
content/webapp/.next/static/chunks/1624.078f48c0e02f531b.js 269 B
content/webapp/.next/static/chunks/2223.13e51946be4f0995.js 1.8 kB
content/webapp/.next/static/chunks/2224.a73abbf8ffcabc4d.js 1.41 kB
content/webapp/.next/static/chunks/2545.c2b990ec5d9479b8.js 1.36 kB
content/webapp/.next/static/chunks/2568.b1076f5e01039efd.js 802 B
content/webapp/.next/static/chunks/2630-4bf3a02ad19c8ede.js 4.46 kB
content/webapp/.next/static/chunks/267-d39fe4d3f0f27696.js 3.67 kB
content/webapp/.next/static/chunks/286.b066630328a98bd8.js 20.8 kB
content/webapp/.next/static/chunks/3.118acbbc2ae9c2bd.js 711 B
content/webapp/.next/static/chunks/3199.4ed9de84fa34a4be.js 439 B
content/webapp/.next/static/chunks/3419.35e7d06626e8c6d0.js 420 B
content/webapp/.next/static/chunks/3420-7e0cf6c9a569a227.js 3.87 kB
content/webapp/.next/static/chunks/3627.3684abdbe8510420.js 1.77 kB
content/webapp/.next/static/chunks/382-ca57e688a4545109.js 3.07 kB
content/webapp/.next/static/chunks/4133-d91fe1f8fc0e2368.js 3.76 kB
content/webapp/.next/static/chunks/4468.bdc27fdcaba7eeb6.js 6.42 kB
content/webapp/.next/static/chunks/4769-8a82adb1709af6d7.js 4.82 kB
content/webapp/.next/static/chunks/4825-4df3e43759acfe8c.js 7.76 kB
content/webapp/.next/static/chunks/4962-1a876f84ea228198.js 12.3 kB
content/webapp/.next/static/chunks/5006-e89ff8af75151368.js 7.15 kB
content/webapp/.next/static/chunks/5048.c1216d2909771efa.js 2.87 kB
content/webapp/.next/static/chunks/5389.d762d43fb2d0a421.js 1.7 kB
content/webapp/.next/static/chunks/5435-4268f265804ebf5e.js 4.6 kB
content/webapp/.next/static/chunks/5768-699dd21166035c67.js 3.18 kB
content/webapp/.next/static/chunks/5843-e7a3b6f6cdcea870.js 3.09 kB
content/webapp/.next/static/chunks/6207.faaccc5f80a44f7a.js 268 B
content/webapp/.next/static/chunks/6318.9b79dafa4a83ab14.js 2.29 kB
content/webapp/.next/static/chunks/6501.a3977bc142afc39e.js 1.35 kB
content/webapp/.next/static/chunks/6577-effbaab7dae5448b.js 3.52 kB
content/webapp/.next/static/chunks/6879.76da889a24c486ba.js 2.6 kB
content/webapp/.next/static/chunks/7107-eecda3d84c2ca297.js 34.1 kB
content/webapp/.next/static/chunks/7414-03438ef5466cad65.js 6 kB
content/webapp/.next/static/chunks/7440.919417010418505e.js 2.85 kB
content/webapp/.next/static/chunks/8069-d320306037284663.js 17.4 kB
content/webapp/.next/static/chunks/8189-461a5e1315036809.js 3.45 kB
content/webapp/.next/static/chunks/8348.7aa3dc55a5cec72b.js 1.26 kB
content/webapp/.next/static/chunks/9042-292aa8c7a960ba0a.js 5.33 kB
content/webapp/.next/static/chunks/9049-a63f6fa100834eba.js 3.63 kB
content/webapp/.next/static/chunks/908.c3283f73c6e55bbf.js 1.79 kB
content/webapp/.next/static/chunks/9519-6080bd680ba0d28a.js 6.16 kB
content/webapp/.next/static/chunks/9590.2d7b95171d8d0866.js 579 B
content/webapp/.next/static/chunks/9680-789f6f04bb823f7e.js 3.12 kB
content/webapp/.next/static/chunks/9778-7a9dca488eda648b.js 3.06 kB
content/webapp/.next/static/chunks/9950.02e3834265565be8.js 1.13 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/concepts/[conceptId]-af7bff21125eb4c7.js 4.39 kB
content/webapp/.next/static/chunks/pages/cookie-policy-d38036ca95595d73.js 6.3 kB
content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-e361b663cc5ee385.js 304 B
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-b0cfcf472928d278.js 304 B
content/webapp/.next/static/chunks/pages/index-15f756c44dd891fa.js 2.01 kB
content/webapp/.next/static/chunks/pages/newsletter-9e19b75aab9d58f4.js 2.39 kB
content/webapp/.next/static/chunks/pages/search/events-147e6a873dcee57a.js 1.52 kB
content/webapp/.next/static/chunks/pages/search/images-c368bfeff46d5e5c.js 2.16 kB
content/webapp/.next/static/chunks/pages/search/works-b4853ff80a576e18.js 4.4 kB
content/webapp/.next/static/chunks/pages/seasons/[seasonId]-005659ad17a2f569.js 3.94 kB
content/webapp/.next/static/chunks/pages/slice-simulator-29a0ef9211652363.js 8.48 kB
content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-13d261b44455da8c.js 242 B
content/webapp/.next/static/chunks/pages/whats-on-425c28a6ef16454b.js 220 B
content/webapp/.next/static/chunks/pages/whats-on/[period]-52becb68c10c131c.js 288 B
content/webapp/.next/static/chunks/pages/works/[workId]-937bbe2b27f85996.js 23.7 kB
content/webapp/.next/static/chunks/pages/works/[workId]/download-ccf37e6191bb73ec.js 3.06 kB
content/webapp/.next/static/chunks/pages/works/[workId]/images-8a8f2334078310e8.js 699 B
content/webapp/.next/static/chunks/pages/works/[workId]/items-55cc335245248060.js 2.4 kB
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-2ca73088ad8338ab.js 16.4 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-5e24da8710b594ff.js 3.21 kB
identity/webapp/.next/static/chunks/pages/error-2784191c63901541.js 1.7 kB
identity/webapp/.next/static/chunks/pages/index-44b48653e661ac63.js 11.9 kB
identity/webapp/.next/static/chunks/pages/registration-0736636262fc3578.js 4.13 kB
identity/webapp/.next/static/chunks/pages/success-1230b17dd14dc2d1.js 3.29 kB
identity/webapp/.next/static/chunks/pages/validated-962f79b0e82f2836.js 3.37 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

@rcantin-w rcantin-w marked this pull request as ready for review October 30, 2024 12:03
@rcantin-w rcantin-w requested a review from a team as a code owner October 30, 2024 12:03
@gestchild
Copy link
Contributor

gestchild commented Oct 30, 2024

I tried previewing the following pages:

The previews all worked, but I don't think the 'visit us' url is the expected one.

If we were to stop the index page rendering at that path it would break

@rcantin-w
Copy link
Contributor Author

The previews all worked, but I don't think the 'visit us' url is the expected one.

You're right, and I am doing that work. I'll have to add the logic inside linkResolver, do we think it's starting to be too much? I could take the logic outside of this for type === 'pages' too?

@rcantin-w
Copy link
Contributor Author

It's just two more lines but don't want it to become too clunky; i've pushed the change so lmk!

// Needed for Prismic previews
const docSiteSection = doc.tags.find(t => isSiteSection(t));

const isLandingPage = docSiteSection === uid;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do this for the 'siteSection' in doc case too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will look into this as a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be addressed here #11354 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rcantin-w rcantin-w merged commit 633c57d into main Oct 30, 2024
8 checks passed
@rcantin-w rcantin-w deleted the fix-pages-preview branch October 30, 2024 14:01
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