-
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
Fix Page preview link #11353
Fix Page preview link #11353
Conversation
…lver to account for untransformed data
|
||
import { isContentType } from './content-types'; | ||
|
||
type Props = { | ||
uid?: string; | ||
type: string; | ||
siteSection?: SiteSection; |
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.
This should've always been there as it's only present in transformed documents.
Size Change: +220 B (+0.02%) Total Size: 982 kB
ℹ️ View Unchanged
|
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 |
You're right, and I am doing that work. I'll have to add the logic inside |
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; |
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.
Do we need to do this for the 'siteSection' in doc case too?
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.
We will look into this as a separate PR
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.
To be addressed here #11354 (comment)
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.
What does this change?
#11346
Moves
siteSection
types and type guard intomodel
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
fromPageLayout
(build was breaking). I know it had to do with the code not being able to compile properly. I moved it intomodel
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