-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Simplified head injection #6034
Conversation
🦋 Changeset detectedLatest commit: 03f66b5 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -13,14 +12,8 @@ const uniqueElements = (item: any, index: number, all: any[]) => { | |||
); | |||
}; | |||
|
|||
async function* renderExtraHead(result: SSRResult, base: string) { |
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.
Removing this function because it causes head rendering to be async. We weren't utilizing this capability anyways. When/if we allow components to inject head content we'll likely want to bring this back, through a small refactor.
} | ||
|
||
export const renderHead = createRenderHead; | ||
export function * renderHead(result: SSRResult) { | ||
yield { type: 'head', result } as const; |
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 is a rendering instruction, like what we have for client directives, which tells the page renderer to inject head at the point (if it hasn't already been injected).
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.
Change makes sense to me! All for sticking with existing patterns. Should get ahead
of future issues
There seems to be a bug in the MDX integration test here:
The selector is not scoped to the head tag, so it will match on any link or script tag anywhere in the document. As per #6057, it seems that this update causes scripts and styles to be inserted into the body, both within MDX documents and components that include layouts, causing a flash of unstyled content. I've also seen this in my own site. |
Changes
Testing
Docs
N/A, bug fix