-
Notifications
You must be signed in to change notification settings - Fork 29
feat(website): SVG optimization bypass and page block observability #1514
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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -232,6 +232,14 @@ export default function Fresh( | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| // Set matched page block name for observability headers | ||||||||||||||||||||||||||||||||
| if (isFreshCtx<DecoState>(ctx) && page?.metadata?.component) { | ||||||||||||||||||||||||||||||||
| // deno-lint-ignore no-explicit-any | ||||||||||||||||||||||||||||||||
| (ctx.state as any).matchedPageBlock = page.metadata.component | ||||||||||||||||||||||||||||||||
| .replace(/^site\//, '') | ||||||||||||||||||||||||||||||||
| .replace(/\.tsx$/, ''); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+235
to
+242
Contributor
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. Fix formatting to resolve pipeline failure. The CI is failing due to
🔧 Proposed fix // Set matched page block name for observability headers
if (isFreshCtx<DecoState>(ctx) && page?.metadata?.component) {
// deno-lint-ignore no-explicit-any
(ctx.state as any).matchedPageBlock = page.metadata.component
- .replace(/^site\//, '')
- .replace(/\.tsx$/, '');
+ .replace(/^site\//, "")
+ .replace(/\.tsx$/, "");
}
- 📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: ci[error] 239-242: deno fmt --check reported: Found 1 not formatted file in 2083 files. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| if (asJson !== null) { | ||||||||||||||||||||||||||||||||
| didFinish = true; | ||||||||||||||||||||||||||||||||
| return Response.json(page, { headers: allowCorsFor(req) }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
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.
SVG path ignores the
preloadprop.When
preload={true}is passed for an SVG image, the preload<Head>link is not rendered since the early return bypasses that logic. This could regress LCP for preloaded SVG hero images.🔧 Suggested fix to support preload for SVG
// SVGs are vector graphics and don't need raster optimization if (isSvg(props.src)) { return ( - <img - {...props} - data-fresh-disable-lock - preload={undefined} - src={props.src} - loading={loading} - ref={ref} - /> + <> + {preload && ( + <Head> + <link as="image" rel="preload" href={props.src} /> + </Head> + )} + <img + {...props} + data-fresh-disable-lock + preload={undefined} + src={props.src} + loading={loading} + ref={ref} + /> + </> ); }📝 Committable suggestion
🤖 Prompt for AI Agents