-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(runtime): check propagation hint for head in tree #13776
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'astro': patch | ||
| --- | ||
|
|
||
| Fixes an internal bug where in some cases the head propagation wasn't correctly flagged. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { isAstroComponentFactory } from './astro/index.js'; | |
| import { renderToAsyncIterable, renderToReadableStream, renderToString } from './astro/render.js'; | ||
| import { encoder } from './common.js'; | ||
| import { isDeno, isNode } from './util.js'; | ||
| import { getPropagationHint } from './astro/factory.js'; | ||
|
|
||
| export async function renderPage( | ||
| result: SSRResult, | ||
|
|
@@ -43,8 +44,9 @@ export async function renderPage( | |
|
|
||
| // Mark if this page component contains a <head> within its tree. If it does | ||
| // We avoid implicit head injection entirely. | ||
| const propagationHint = getPropagationHint(result, componentFactory); | ||
| result._metadata.headInTree = | ||
| result.componentMetadata.get(componentFactory.moduleId!)?.containsHead ?? false; | ||
| result.componentMetadata.get(componentFactory.moduleId!)?.containsHead ?? propagationHint === 'in-tree'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this also be checking for propagationHint === 'self'? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems not. When working with propagation, the Astro engine assigns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, thinking about it again, the The purpose is to support cases where there is no explicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhm OK. I will create a different flag then, Thank you for your comments! |
||
|
|
||
| let body: BodyInit | Response; | ||
| if (streaming) { | ||
|
|
||
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.
don't we have this same function somewhere else? Or is it different? If the same we should reuse.
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.
The other function is in the same file, few lines up. It's different and it checks if
hint === 'in-tree' || hint === 'self'.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.
Shouldn't that function use this one then?
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.
Makes sense!